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

LibWeb: Add virtuals to check if Paintable is PBox or PWithLines

Instead of inferring the type of paintables by looking at the type of
their origin in the layout tree, let's ask them directly.
This commit is contained in:
Andreas Kling 2023-08-18 13:47:52 +02:00
parent 6b3af92262
commit 136ac1a6a5
4 changed files with 16 additions and 7 deletions

View file

@ -154,6 +154,9 @@ public:
template<typename T>
bool fast_is() const = delete;
[[nodiscard]] virtual bool is_paintable_box() const { return false; }
[[nodiscard]] virtual bool is_paintable_with_lines() const { return false; }
StackingContext const* stacking_context_rooted_here() const;
protected:
@ -179,6 +182,9 @@ inline DOM::Node const* HitTestResult::dom_node() const
}
template<>
inline bool Paintable::fast_is<PaintableBox>() const { return m_layout_node->is_box(); }
inline bool Paintable::fast_is<PaintableBox>() const { return is_paintable_box(); }
template<>
inline bool Paintable::fast_is<PaintableWithLines>() const { return is_paintable_with_lines(); }
}