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

LibWeb: Only store one DOM pointer per Layout::Node

Instead of storing two JS::Handles into the DOM, we can combine them
into a single one.

If the layout node is anonymous, m_dom_node points to the DOM::Document.
Otherwise, m_dom_node points to the associated DOM node.

The anonymous state is moved to an m_anonymous boolean member.

This cuts the number of JS::Handles created by the layout tree in half
(and shrinks Layout::Node by 8 bytes).
This commit is contained in:
Andreas Kling 2022-10-16 16:42:39 +02:00
parent 18a5c56f14
commit be5a39657e
2 changed files with 14 additions and 10 deletions

View file

@ -143,12 +143,12 @@ protected:
private:
friend class NodeWithStyle;
JS::Handle<DOM::Document> m_document;
JS::Handle<DOM::Node> m_dom_node;
RefPtr<Painting::Paintable> m_paintable;
size_t m_serial_id { 0 };
bool m_anonymous { false };
bool m_has_style { false };
bool m_visible { true };
bool m_children_are_inline { false };