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
Notes: sideshowbarker 2024-07-19 11:42:50 +09:00
6 changed files with 51 additions and 20 deletions

View file

@ -17,7 +17,7 @@ LayoutNode::LayoutNode(const Node* node)
LayoutNode::~LayoutNode()
{
if (m_node)
if (m_node && m_node->layout_node() == this)
m_node->set_layout_node({}, nullptr);
}