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

Unified Diff: Source/core/css/RuleFeature.cpp

Issue 217713002: Refactor StyleInvalidator to encapsulate all style invalidation state. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove explicit. Created 6 years, 9 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 | « Source/core/css/RuleFeature.h ('k') | Source/core/css/invalidation/StyleInvalidator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/RuleFeature.cpp
diff --git a/Source/core/css/RuleFeature.cpp b/Source/core/css/RuleFeature.cpp
index f8ce8dd99902cd8455f5b19516311ed85ed56980..bdc04544ce4e4a588c187dbca89a74e2ef7ea4b5 100644
--- a/Source/core/css/RuleFeature.cpp
+++ b/Source/core/css/RuleFeature.cpp
@@ -348,10 +348,10 @@ void RuleFeatureSet::clear()
m_metadata.clear();
m_classInvalidationSets.clear();
m_attributeInvalidationSets.clear();
- m_pendingInvalidationMap.clear();
+ m_styleInvalidator.clearPendingInvalidations();
}
-void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitString& changedClasses, Element* element)
+void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitString& changedClasses, Element& element)
{
unsigned changedSize = changedClasses.size();
for (unsigned i = 0; i < changedSize; ++i) {
@@ -359,7 +359,7 @@ void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitStr
}
}
-void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, Element* element)
+void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, Element& element)
{
if (!oldClasses.size())
scheduleStyleInvalidationForClassChange(newClasses, element);
@@ -392,41 +392,21 @@ void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitStr
}
}
-void RuleFeatureSet::scheduleStyleInvalidationForAttributeChange(const QualifiedName& attributeName, Element* element)
+void RuleFeatureSet::scheduleStyleInvalidationForAttributeChange(const QualifiedName& attributeName, Element& element)
{
- if (RefPtr<DescendantInvalidationSet> invalidationSet = m_attributeInvalidationSets.get(attributeName.localName())) {
- ensurePendingInvalidationList(element).append(invalidationSet);
- element->setNeedsStyleInvalidation();
- }
-}
-
-void RuleFeatureSet::addClassToInvalidationSet(const AtomicString& className, Element* element)
-{
- if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationSets.get(className)) {
- ensurePendingInvalidationList(element).append(invalidationSet);
- element->setNeedsStyleInvalidation();
- }
-}
-
-RuleFeatureSet::InvalidationList& RuleFeatureSet::ensurePendingInvalidationList(Element* element)
-{
- PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(element, nullptr);
- if (addResult.isNewEntry)
- addResult.storedValue->value = adoptPtr(new InvalidationList);
- return *addResult.storedValue->value;
+ if (RefPtr<DescendantInvalidationSet> invalidationSet = m_attributeInvalidationSets.get(attributeName.localName()))
+ m_styleInvalidator.scheduleInvalidation(invalidationSet, element);
}
-void RuleFeatureSet::clearStyleInvalidation(Node* node)
+void RuleFeatureSet::addClassToInvalidationSet(const AtomicString& className, Element& element)
{
- node->clearChildNeedsStyleInvalidation();
- node->clearNeedsStyleInvalidation();
- if (node->isElementNode())
- m_pendingInvalidationMap.remove(toElement(node));
+ if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationSets.get(className))
+ m_styleInvalidator.scheduleInvalidation(invalidationSet, element);
}
-RuleFeatureSet::PendingInvalidationMap& RuleFeatureSet::pendingInvalidationMap()
+StyleInvalidator& RuleFeatureSet::styleInvalidator()
{
- return m_pendingInvalidationMap;
+ return m_styleInvalidator;
}
} // namespace WebCore
« no previous file with comments | « Source/core/css/RuleFeature.h ('k') | Source/core/css/invalidation/StyleInvalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698