From d5bbf8dcf803c429afab76610dfba3b1ee23f0ae Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 23 Dec 2024 15:24:09 +0100 Subject: [PATCH] LibWeb: Do lighter style invalidation for `style` attribute changes When the `style` attribute changes, we only need to update style on the element itself (unless there are [style] attribute selectors somewhere). Descendants of the element don't need a full style update, a simple inheritance propagation is enough. --- Libraries/LibWeb/DOM/Element.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index 132f3b7f9dc..2569f340f68 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -1902,7 +1902,21 @@ ErrorOr Element::scroll_into_view(Optional(node); + element.set_needs_inherited_style_update(true); + return TraversalDecision::Continue; + }); + return; + } invalidate_style(StyleInvalidationReason::ElementAttributeChange); }