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

LibWeb: Copy various flags from layout node to paintable

This removes indirection when asking if a paintable is positioned,
floating, etc.

Removes a bunch of 1-1.5% items in the profile when hovering links
on ziglang.org.
This commit is contained in:
Andreas Kling 2024-03-02 11:03:02 +01:00
parent c69b266e43
commit 881e7fcee1
2 changed files with 28 additions and 21 deletions

View file

@ -56,12 +56,12 @@ class Paintable
public:
virtual ~Paintable();
[[nodiscard]] bool is_visible() const;
[[nodiscard]] bool is_positioned() const;
[[nodiscard]] bool is_fixed_position() const { return layout_node().is_fixed_position(); }
[[nodiscard]] bool is_absolutely_positioned() const { return layout_node().is_absolutely_positioned(); }
[[nodiscard]] bool is_floating() const { return layout_node().is_floating(); }
[[nodiscard]] bool is_inline() const { return layout_node().is_inline(); }
[[nodiscard]] bool is_visible() const { return m_visible; }
[[nodiscard]] bool is_positioned() const { return m_positioned; }
[[nodiscard]] bool is_fixed_position() const { return m_fixed_position; }
[[nodiscard]] bool is_absolutely_positioned() const { return m_absolutely_positioned; }
[[nodiscard]] bool is_floating() const { return m_floating; }
[[nodiscard]] bool is_inline() const { return m_inline; }
[[nodiscard]] CSS::Display display() const { return layout_node().display(); }
template<typename U, typename Callback>
@ -217,6 +217,13 @@ private:
Optional<JS::GCPtr<PaintableBox>> mutable m_containing_block;
OwnPtr<StackingContext> m_stacking_context;
bool m_visible : 1 { false };
bool m_positioned : 1 { false };
bool m_fixed_position : 1 { false };
bool m_absolutely_positioned : 1 { false };
bool m_floating : 1 { false };
bool m_inline : 1 { false };
};
inline DOM::Node* HitTestResult::dom_node()