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

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

Issue 2116503002: Skip scheduling sibling invalidation based on direct adjacent count. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/StyleEngine.cpp
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
index eebbfe8ddd8d38fa8c3bf7bd635a58bdc4b23824..f6628b6448252e74358d5de8bdf1a83e0f12c688 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -694,25 +694,27 @@ void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoTyp
m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, element);
}
-void StyleEngine::scheduleSiblingInvalidationsForElement(Element& element, ContainerNode& schedulingParent)
+void StyleEngine::scheduleSiblingInvalidationsForElement(Element& element, ContainerNode& schedulingParent, unsigned minDirectAdjacent)
{
+ DCHECK(minDirectAdjacent);
+
InvalidationLists invalidationLists;
RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSet();
if (element.hasID())
- ruleFeatureSet.collectSiblingInvalidationSetForId(invalidationLists, element, element.idForStyleResolution());
+ ruleFeatureSet.collectSiblingInvalidationSetForId(invalidationLists, element, element.idForStyleResolution(), minDirectAdjacent);
if (element.hasClass()) {
const SpaceSplitString& classNames = element.classNames();
for (size_t i = 0; i < classNames.size(); i++)
- ruleFeatureSet.collectSiblingInvalidationSetForClass(invalidationLists, element, classNames[i]);
+ ruleFeatureSet.collectSiblingInvalidationSetForClass(invalidationLists, element, classNames[i], minDirectAdjacent);
}
for (const Attribute& attribute : element.attributes())
- ruleFeatureSet.collectSiblingInvalidationSetForAttribute(invalidationLists, element, attribute.name());
+ ruleFeatureSet.collectSiblingInvalidationSetForAttribute(invalidationLists, element, attribute.name(), minDirectAdjacent);
- ruleFeatureSet.collectUniversalSiblingInvalidationSet(invalidationLists);
+ ruleFeatureSet.collectUniversalSiblingInvalidationSet(invalidationLists, minDirectAdjacent);
m_styleInvalidator.scheduleSiblingInvalidationsAsDescendants(invalidationLists, schedulingParent);
}
@@ -725,10 +727,10 @@ void StyleEngine::scheduleInvalidationsForInsertedSibling(Element* beforeElement
if (!schedulingParent)
return;
- scheduleSiblingInvalidationsForElement(insertedElement, *schedulingParent);
+ scheduleSiblingInvalidationsForElement(insertedElement, *schedulingParent, 1);
- for (unsigned i = 0; beforeElement && i < affectedSiblings; i++, beforeElement = ElementTraversal::previousSibling(*beforeElement))
- scheduleSiblingInvalidationsForElement(*beforeElement, *schedulingParent);
+ for (unsigned i = 1; beforeElement && i <= affectedSiblings; i++, beforeElement = ElementTraversal::previousSibling(*beforeElement))
+ scheduleSiblingInvalidationsForElement(*beforeElement, *schedulingParent, i);
}
void StyleEngine::scheduleInvalidationsForRemovedSibling(Element* beforeElement, Element& removedElement, Element& afterElement)
@@ -739,10 +741,10 @@ void StyleEngine::scheduleInvalidationsForRemovedSibling(Element* beforeElement,
if (!schedulingParent)
return;
- scheduleSiblingInvalidationsForElement(removedElement, *schedulingParent);
+ scheduleSiblingInvalidationsForElement(removedElement, *schedulingParent, 1);
- for (unsigned i = 1; beforeElement && i < affectedSiblings; i++, beforeElement = ElementTraversal::previousSibling(*beforeElement))
- scheduleSiblingInvalidationsForElement(*beforeElement, *schedulingParent);
+ for (unsigned i = 2; beforeElement && i <= affectedSiblings; i++, beforeElement = ElementTraversal::previousSibling(*beforeElement))
+ scheduleSiblingInvalidationsForElement(*beforeElement, *schedulingParent, i);
}
void StyleEngine::setStatsEnabled(bool enabled)
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698