mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:27:35 +00:00
LibWeb: Add fast_is<T>() for various types stood out in a profile
This commit is contained in:
parent
f6426cdcd4
commit
1cf5737e9e
8 changed files with 48 additions and 0 deletions
|
@ -25,9 +25,13 @@ public:
|
|||
void set_marker(JS::GCPtr<ListItemMarkerBox>);
|
||||
|
||||
private:
|
||||
virtual bool is_list_item_box() const override { return true; }
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
JS::GCPtr<ListItemMarkerBox> m_marker;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Node::fast_is<ListItemBox>() const { return is_list_item_box(); }
|
||||
}
|
||||
|
|
|
@ -89,11 +89,14 @@ public:
|
|||
virtual bool is_viewport() const { return false; }
|
||||
virtual bool is_svg_box() const { return false; }
|
||||
virtual bool is_svg_geometry_box() const { return false; }
|
||||
virtual bool is_svg_svg_box() const { return false; }
|
||||
virtual bool is_label() const { return false; }
|
||||
virtual bool is_replaced_box() const { return false; }
|
||||
virtual bool is_list_item_box() const { return false; }
|
||||
virtual bool is_list_item_marker_box() const { return false; }
|
||||
virtual bool is_table_wrapper() const { return false; }
|
||||
virtual bool is_table() const { return false; }
|
||||
virtual bool is_node_with_style_and_box_model_metrics() const { return false; }
|
||||
|
||||
template<typename T>
|
||||
bool fast_is() const = delete;
|
||||
|
@ -219,9 +222,14 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
virtual bool is_node_with_style_and_box_model_metrics() const final { return true; }
|
||||
|
||||
BoxModelMetrics m_box_model;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Node::fast_is<NodeWithStyleAndBoxModelMetrics>() const { return is_node_with_style_and_box_model_metrics(); }
|
||||
|
||||
inline Gfx::Font const& Node::font() const
|
||||
{
|
||||
if (m_has_style)
|
||||
|
|
|
@ -25,6 +25,12 @@ public:
|
|||
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
|
||||
|
||||
virtual void prepare_for_replaced_layout() override;
|
||||
|
||||
private:
|
||||
virtual bool is_svg_svg_box() const final { return true; }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Node::fast_is<SVGSVGBox>() const { return is_svg_svg_box(); }
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue