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

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

Issue 1317533002: Sibling invalidation sets (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 3 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: Source/core/dom/StyleEngine.cpp
diff --git a/Source/core/dom/StyleEngine.cpp b/Source/core/dom/StyleEngine.cpp
index 8f61504461b5ddd1396365e116888792f32fd843..ba132b38376df153c5e72f0f938d1910b5d35de8 100644
--- a/Source/core/dom/StyleEngine.cpp
+++ b/Source/core/dom/StyleEngine.cpp
@@ -36,6 +36,7 @@
#include "core/css/resolver/ScopedStyleResolver.h"
#include "core/dom/DocumentStyleSheetCollector.h"
#include "core/dom/Element.h"
+#include "core/dom/ElementTraversal.h"
#include "core/dom/ProcessingInstruction.h"
#include "core/dom/ShadowTreeStyleSheetCollection.h"
#include "core/dom/shadow/ShadowRoot.h"
@@ -631,18 +632,17 @@ void StyleEngine::platformColorsChanged()
void StyleEngine::classChangedForElement(const SpaceSplitString& changedClasses, Element& element)
{
ASSERT(isMaster());
- InvalidationSetVector invalidationSets;
+ InvalidationSetVector descendant, sibling;
Timothy Loh 2015/09/10 06:09:40 Needs a class or struct or something instead of pa
esprehn 2015/09/10 08:54:53 One variable per line
Eric Willigers 2015/09/14 07:20:24 Done.
Eric Willigers 2015/09/14 07:20:24 Acknowledged.
unsigned changedSize = changedClasses.size();
RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSet();
for (unsigned i = 0; i < changedSize; ++i)
- ruleFeatureSet.collectInvalidationSetsForClass(invalidationSets, element, changedClasses[i]);
- scheduleInvalidationSetsForElement(invalidationSets, element);
+ ruleFeatureSet.collectInvalidationSetsForClass(descendant, sibling, element, changedClasses[i]);
+ m_styleInvalidator.scheduleInvalidationSetsForElement(descendant, sibling, element);
}
void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, Element& element)
{
ASSERT(isMaster());
- InvalidationSetVector invalidationSets;
if (!oldClasses.size()) {
classChangedForElement(newClasses, element);
return;
@@ -652,6 +652,7 @@ void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, con
BitVector remainingClassBits;
remainingClassBits.ensureSize(oldClasses.size());
+ InvalidationSetVector descendant, sibling;
RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSet();
for (unsigned i = 0; i < newClasses.size(); ++i) {
@@ -667,51 +668,45 @@ void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, con
}
// Class was added.
if (!found)
- ruleFeatureSet.collectInvalidationSetsForClass(invalidationSets, element, newClasses[i]);
+ ruleFeatureSet.collectInvalidationSetsForClass(descendant, sibling, element, newClasses[i]);
}
for (unsigned i = 0; i < oldClasses.size(); ++i) {
if (remainingClassBits.quickGet(i))
continue;
// Class was removed.
- ruleFeatureSet.collectInvalidationSetsForClass(invalidationSets, element, oldClasses[i]);
+ ruleFeatureSet.collectInvalidationSetsForClass(descendant, sibling, element, oldClasses[i]);
}
- scheduleInvalidationSetsForElement(invalidationSets, element);
+ m_styleInvalidator.scheduleInvalidationSetsForElement(descendant, sibling, element);
}
void StyleEngine::attributeChangedForElement(const QualifiedName& attributeName, Element& element)
{
ASSERT(isMaster());
- InvalidationSetVector invalidationSets;
- ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForAttribute(invalidationSets, element, attributeName);
- scheduleInvalidationSetsForElement(invalidationSets, element);
+ InvalidationSetVector descendant, sibling;
+ ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForAttribute(descendant, sibling, element, attributeName);
+ m_styleInvalidator.scheduleInvalidationSetsForElement(descendant, sibling, element);
}
void StyleEngine::idChangedForElement(const AtomicString& oldId, const AtomicString& newId, Element& element)
{
ASSERT(isMaster());
- InvalidationSetVector invalidationSets;
+ InvalidationSetVector descendant, sibling;
RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSet();
if (!oldId.isEmpty())
- ruleFeatureSet.collectInvalidationSetsForId(invalidationSets, element, oldId);
+ ruleFeatureSet.collectInvalidationSetsForId(descendant, sibling, element, oldId);
if (!newId.isEmpty())
- ruleFeatureSet.collectInvalidationSetsForId(invalidationSets, element, newId);
- scheduleInvalidationSetsForElement(invalidationSets, element);
+ ruleFeatureSet.collectInvalidationSetsForId(descendant, sibling, element, newId);
+ m_styleInvalidator.scheduleInvalidationSetsForElement(descendant, sibling, element);
}
void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoType, Element& element)
{
ASSERT(isMaster());
- InvalidationSetVector invalidationSets;
- ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPseudoClass(invalidationSets, element, pseudoType);
- scheduleInvalidationSetsForElement(invalidationSets, element);
-}
-
-void StyleEngine::scheduleInvalidationSetsForElement(const InvalidationSetVector& invalidationSets, Element& element)
-{
- for (auto invalidationSet : invalidationSets)
- m_styleInvalidator.scheduleInvalidation(invalidationSet, element);
+ InvalidationSetVector descendant, sibling;
+ ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPseudoClass(descendant, sibling, element, pseudoType);
+ m_styleInvalidator.scheduleInvalidationSetsForElement(descendant, sibling, element);
}
DEFINE_TRACE(StyleEngine)

Powered by Google App Engine
This is Rietveld 408576698