Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 2235723002: Use invalidation sets for nth invalidations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment ::before/::after Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/ContainerNode.cpp
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index 56e6d7f94a91ca27078ad1250620c405b0e82712..f995b38ba7c473aac457c3f8bb8c4c51ae7cf4cf 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -1232,22 +1232,16 @@ void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, Ele
Element* elementAfterChange = !nodeAfterChange || nodeAfterChange->isElementNode() ? toElement(nodeAfterChange) : ElementTraversal::nextSibling(*nodeAfterChange);
Element* elementBeforeChange = !nodeBeforeChange || nodeBeforeChange->isElementNode() ? toElement(nodeBeforeChange) : ElementTraversal::previousSibling(*nodeBeforeChange);
+ // TODO(rune@opera.com): move this code into StyleEngine and collect the
+ // various invalidation sets into a single InvalidationLists object and
+ // schedule with a single scheduleInvalidationSetsForNode for efficiency.
+
// Forward positional selectors include :nth-child, :nth-of-type,
- // :first-of-type, and only-of-type. The indirect adjacent selector is the ~
- // selector. 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 and
- // indirect adjacent case, and everything before the insertion point in the
- // backward case. |nodeAfterChange| is nullptr 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.
+ // :first-of-type, and only-of-type. Backward positional selectors include
+ // :nth-last-child, :nth-last-of-type, :last-of-type, and :only-of-type.
if ((childrenAffectedByForwardPositionalRules() && elementAfterChange)
|| (childrenAffectedByBackwardPositionalRules() && elementBeforeChange)) {
- setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::SiblingSelector));
- return;
+ document().styleEngine().scheduleNthPseudoInvalidations(*this);
}
if (childrenAffectedByFirstChildRules() && !elementBeforeChange && elementAfterChange && elementAfterChange->affectedByFirstChildRules()) {
« no previous file with comments | « third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp ('k') | third_party/WebKit/Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698