LibWeb: Don't invalidate style of parent of inserted node

There is no need for this invalidation because taking care of siblings
is already done by invalidation with `NodeInsertBefore` reason. Parent
element itself (without subtree) is always invalidated by
`Node::children_changed()` hook, so `:empty` pseudo-class invalidation
is already covered.
This commit is contained in:
Aliaksandr Kalenik 2025-02-06 02:26:35 +01:00 committed by Andreas Kling
parent daf7c1ef60
commit f7a3f785a8
Notes: github-actions[bot] 2025-02-06 19:08:21 +00:00
2 changed files with 1 additions and 7 deletions

View file

@ -767,12 +767,6 @@ void Node::insert_before(GC::Ref<Node> node, GC::Ptr<Node> child, bool suppress_
node->post_connection(); node->post_connection();
} }
if (is_connected()) {
// FIXME: This will need to become smarter when we implement the :has() selector.
invalidate_style(StyleInvalidationReason::ParentOfInsertedNode);
set_needs_layout_tree_update(true);
}
document().bump_dom_tree_version(); document().bump_dom_tree_version();
} }
@ -1411,6 +1405,7 @@ void Node::set_needs_style_update(bool value)
void Node::post_connection() void Node::post_connection()
{ {
set_needs_layout_tree_update(true);
} }
void Node::inserted() void Node::inserted()

View file

@ -88,7 +88,6 @@ enum class ShouldComputeRole {
X(NodeRemove) \ X(NodeRemove) \
X(NodeSetTextContent) \ X(NodeSetTextContent) \
X(Other) \ X(Other) \
X(ParentOfInsertedNode) \
X(SetSelectorText) \ X(SetSelectorText) \
X(SettingsChange) \ X(SettingsChange) \
X(StyleSheetDeleteRule) \ X(StyleSheetDeleteRule) \