LibWeb: Add fast_is<T> optimization for more paintables

We were doing a lot of dynamic_cast with these types, so let's avoid it.
This commit is contained in:
Andreas Kling 2025-09-21 14:14:39 +02:00 committed by Andreas Kling
parent 4eca3781c7
commit 84bedebb09
Notes: github-actions[bot] 2025-09-22 13:02:05 +00:00
4 changed files with 20 additions and 0 deletions

View file

@ -45,6 +45,8 @@ public:
ReadonlySpan<GC::Ref<PaintableBox>> paintable_boxes_with_auto_content_visibility() const { return m_paintable_boxes_with_auto_content_visibility; }
private:
virtual bool is_viewport_paintable() const override { return true; }
void build_stacking_context_tree();
explicit ViewportPaintable(Layout::Viewport const&);
@ -57,4 +59,7 @@ private:
Vector<GC::Ref<PaintableBox>> m_paintable_boxes_with_auto_content_visibility;
};
template<>
inline bool Paintable::fast_is<ViewportPaintable>() const { return is_viewport_paintable(); }
}