mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
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:
parent
4eca3781c7
commit
84bedebb09
|
|
@ -118,10 +118,13 @@ public:
|
|||
bool fast_is() const = delete;
|
||||
|
||||
[[nodiscard]] virtual bool is_navigable_container_viewport_paintable() const { return false; }
|
||||
[[nodiscard]] virtual bool is_viewport_paintable() const { return false; }
|
||||
[[nodiscard]] virtual bool is_paintable_box() const { return false; }
|
||||
[[nodiscard]] virtual bool is_paintable_with_lines() const { return false; }
|
||||
[[nodiscard]] virtual bool is_svg_paintable() const { return false; }
|
||||
[[nodiscard]] virtual bool is_svg_svg_paintable() const { return false; }
|
||||
[[nodiscard]] virtual bool is_svg_path_paintable() const { return false; }
|
||||
[[nodiscard]] virtual bool is_svg_graphics_paintable() const { return false; }
|
||||
[[nodiscard]] virtual bool is_text_paintable() const { return false; }
|
||||
|
||||
DOM::Document const& document() const;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@ protected:
|
|||
SVGGraphicsPaintable(Layout::SVGGraphicsBox const&);
|
||||
|
||||
ComputedTransforms m_computed_transforms;
|
||||
|
||||
private:
|
||||
virtual bool is_svg_graphics_paintable() const final { return true; }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Paintable::fast_is<SVGGraphicsPaintable>() const { return is_svg_graphics_paintable(); }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@ protected:
|
|||
SVGPathPaintable(Layout::SVGGraphicsBox const&);
|
||||
|
||||
Optional<Gfx::Path> m_computed_path = {};
|
||||
|
||||
private:
|
||||
virtual bool is_svg_path_paintable() const final { return true; }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Paintable::fast_is<SVGPathPaintable>() const { return is_svg_path_paintable(); }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(); }
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user