Title: [230396] releases/WebKitGTK/webkit-2.20/Source/WebCore
Revision
230396
Author
carlo...@webkit.org
Date
2018-04-09 03:52:43 -0700 (Mon, 09 Apr 2018)

Log Message

Merge r229288 - Don't invalidate all children when doing insertion/deletion in presence of backward positional selectors
https://bugs.webkit.org/show_bug.cgi?id=183325
<rdar://problem/38134480>

Reviewed by Zalan Bujtas.

It is sufficient to invalidate siblings before the mutation point.

* dom/Element.cpp:
(WebCore::checkForSiblingStyleChanges):

We already do sibling walk in the case of forwards positional rules and sibling combinators. The work
done here is insignifant compared to cost of overinvalidating.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (230395 => 230396)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-04-09 10:52:37 UTC (rev 230395)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-04-09 10:52:43 UTC (rev 230396)
@@ -1,3 +1,19 @@
+2018-03-05  Antti Koivisto  <an...@apple.com>
+
+        Don't invalidate all children when doing insertion/deletion in presence of backward positional selectors
+        https://bugs.webkit.org/show_bug.cgi?id=183325
+        <rdar://problem/38134480>
+
+        Reviewed by Zalan Bujtas.
+
+        It is sufficient to invalidate siblings before the mutation point.
+
+        * dom/Element.cpp:
+        (WebCore::checkForSiblingStyleChanges):
+
+        We already do sibling walk in the case of forwards positional rules and sibling combinators. The work
+        done here is insignifant compared to cost of overinvalidating.
+
 2018-03-03  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Delete incorrect version of clampTo() function from SVGToOTFFontConversion.cpp

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/dom/Element.cpp (230395 => 230396)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/dom/Element.cpp	2018-04-09 10:52:37 UTC (rev 230395)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/dom/Element.cpp	2018-04-09 10:52:43 UTC (rev 230396)
@@ -2077,11 +2077,10 @@
     // Backward positional selectors include nth-last-child, nth-last-of-type, last-of-type and only-of-type.
     // We have to invalidate everything following the insertion point in the forward case, and everything before the insertion point in the
     // backward case.
-    // |afterChange| is 0 in the parser callback case, so we won't do any work for the forward case if we don't have to.
-    // For performance reasons we just mark the parent node as changed, since we don't want to make childrenChanged O(n^2) by crawling all our kids
-    // here.  recalcStyle will then force a walk of the children when it sees that this has happened.
-    if (parent.childrenAffectedByBackwardPositionalRules() && elementBeforeChange)
-        parent.invalidateStyleForSubtree();
+    if (parent.childrenAffectedByBackwardPositionalRules()) {
+        for (auto* previous = elementBeforeChange; previous; previous = previous->previousElementSibling())
+            previous->invalidateStyleForSubtree();
+    }
 }
 
 void Element::childrenChanged(const ChildChange& change)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to