LibWeb: Allow building partial layout trees

We can now build partial layout trees (this happens for example when an
element's "display" property is programmatically toggled from "none" to
something else.)
This commit is contained in:
Andreas Kling 2020-11-29 16:11:54 +01:00
parent 127274fd42
commit 4ebb57298b
Notes: sideshowbarker 2024-07-19 01:11:56 +09:00

View file

@ -140,9 +140,10 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node)
RefPtr<Node> TreeBuilder::build(DOM::Node& dom_node)
{
if (!is<DOM::Document>(dom_node) && dom_node.has_children()) {
dbg() << "FIXME: Support building partial layout trees.";
return nullptr;
if (dom_node.parent()) {
// We're building a partial layout tree, so start by building up the stack of parent layout nodes.
for (auto* ancestor = dom_node.parent()->layout_node(); ancestor; ancestor = ancestor->parent())
m_parent_stack.prepend(ancestor);
}
create_layout_tree(dom_node);