LibWeb: Use partial layout tree rebuild in element's style invalidation

This allows us to avoid a full layout tree rebuild after change of
"display" property, which happens frequently in practice. It also
allows us to avoid a full rebuild after DOM node insertion, since
previously, computing styles for newly inserted nodes would trigger a
complete layout tree rebuild.
This commit is contained in:
Aliaksandr Kalenik 2025-03-06 21:13:21 +01:00 committed by Andreas Kling
commit 9b26f7eb0f
Notes: github-actions[bot] 2025-03-06 22:49:27 +00:00
2 changed files with 23 additions and 12 deletions

View file

@ -787,6 +787,9 @@ void Node::insert_before(GC::Ref<Node> node, GC::Ptr<Node> child, bool suppress_
}
if (is_connected()) {
if (layout_node() && layout_node()->display().is_contents() && parent_element()) {
parent_element()->set_needs_layout_tree_update(true);
}
set_needs_layout_tree_update(true);
}