1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

LibWeb: Add some fast_is<T> helpers for hot classes on GitHub :^)

This commit is contained in:
Andreas Kling 2022-03-13 17:21:27 +01:00
parent 74fda2a761
commit afc5fade05
5 changed files with 16 additions and 0 deletions

View file

@ -24,6 +24,7 @@ public:
CSS::ListStyleType list_style_type() const { return m_list_style_type; }
private:
virtual bool is_list_item_marker_box() const final { return true; }
virtual bool can_have_children() const override { return false; }
CSS::ListStyleType m_list_style_type { CSS::ListStyleType::None };
@ -32,4 +33,7 @@ private:
String m_text {};
};
template<>
inline bool Node::fast_is<ListItemMarkerBox>() const { return is_list_item_marker_box(); }
}

View file

@ -74,6 +74,8 @@ public:
virtual bool is_svg_box() const { return false; }
virtual bool is_svg_geometry_box() const { return false; }
virtual bool is_label() const { return false; }
virtual bool is_replaced_box() const { return false; }
virtual bool is_list_item_marker_box() const { return false; }
template<typename T>
bool fast_is() const = delete;

View file

@ -32,9 +32,14 @@ public:
virtual bool can_have_children() const override { return false; }
private:
virtual bool is_replaced_box() const final { return true; }
Optional<float> m_intrinsic_width;
Optional<float> m_intrinsic_height;
Optional<float> m_intrinsic_aspect_ratio;
};
template<>
inline bool Node::fast_is<ReplacedBox>() const { return is_replaced_box(); }
}