Title: [229288] trunk/Source/WebCore
- Revision
- 229288
- Author
- [email protected]
- Date
- 2018-03-05 10:43:53 -0800 (Mon, 05 Mar 2018)
Log Message
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: trunk/Source/WebCore/ChangeLog (229287 => 229288)
--- trunk/Source/WebCore/ChangeLog 2018-03-05 18:31:40 UTC (rev 229287)
+++ trunk/Source/WebCore/ChangeLog 2018-03-05 18:43:53 UTC (rev 229288)
@@ -1,3 +1,19 @@
+2018-03-05 Antti Koivisto <[email protected]>
+
+ 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-05 Ali Juma <[email protected]>
imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html times out with async policy delegates
Modified: trunk/Source/WebCore/dom/Element.cpp (229287 => 229288)
--- trunk/Source/WebCore/dom/Element.cpp 2018-03-05 18:31:40 UTC (rev 229287)
+++ trunk/Source/WebCore/dom/Element.cpp 2018-03-05 18:43:53 UTC (rev 229288)
@@ -2076,11 +2076,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes