1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 06:25:07 +00:00

LibHTML: Move layout root from HtmlView to Document

The layout root is now kept alive via Document::m_layout_root.
This will allow us to do more layout-related things inside the inner
layer of LibHTML without reaching out to the HtmlView.

I'd like to keep HtmlView at a slightly higher level, to prevent it
from getting too complex.

This patch also fixes accidental disconnection of the layout tree from
the DOM after doing a layout tree rebuild. ~LayoutNode() now only
unsets the DOM node's layout_node() if it's itself.
This commit is contained in:
Andreas Kling 2019-10-13 12:34:25 +02:00
parent 48ef1d1bd1
commit 49ac0c2e24
6 changed files with 51 additions and 20 deletions

View file

@ -15,6 +15,9 @@ public:
const Document* document() const { return m_document; }
void set_document(Document*);
const LayoutDocument* layout_root() const;
LayoutDocument* layout_root();
Frame& main_frame() { return *m_main_frame; }
const Frame& main_frame() const { return *m_main_frame; }
@ -42,7 +45,6 @@ private:
RefPtr<Frame> m_main_frame;
RefPtr<Document> m_document;
RefPtr<LayoutNode> m_layout_root;
bool m_should_show_line_box_borders { false };
};