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

Unified Diff: Source/core/css/analyzer/DescendantInvalidationSet.cpp

Issue 208323003: Add support for attribute selectors in TargetedStyleRecalc. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix compilation 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
Index: Source/core/css/analyzer/DescendantInvalidationSet.cpp
diff --git a/Source/core/css/analyzer/DescendantInvalidationSet.cpp b/Source/core/css/analyzer/DescendantInvalidationSet.cpp
index 5dd11f92160fc624e143f06eb62e2d4edac98780..7b46598300aeaaf8be3b127e8ca4703e5c43301b 100644
--- a/Source/core/css/analyzer/DescendantInvalidationSet.cpp
+++ b/Source/core/css/analyzer/DescendantInvalidationSet.cpp
@@ -69,6 +69,12 @@ void DescendantInvalidationSet::combine(const DescendantInvalidationSet& other)
for (HashSet<AtomicString>::const_iterator it = other.m_tagNames->begin(); it != end; ++it)
addTagName(*it);
}
+
+ if (other.m_attributes) {
+ HashSet<AtomicString>::const_iterator end = other.m_attributes->end();
+ for (HashSet<AtomicString>::const_iterator it = other.m_attributes->begin(); it != end; ++it)
+ addAttribute(*it);
+ }
}
HashSet<AtomicString>& DescendantInvalidationSet::ensureClassSet()
@@ -92,6 +98,13 @@ HashSet<AtomicString>& DescendantInvalidationSet::ensureTagNameSet()
return *m_tagNames;
}
+HashSet<AtomicString>& DescendantInvalidationSet::ensureAttributeSet()
+{
+ if (!m_attributes)
+ m_attributes = adoptPtr(new HashSet<AtomicString>);
+ return *m_attributes;
+}
+
void DescendantInvalidationSet::addClass(const AtomicString& className)
{
if (wholeSubtreeInvalid())
@@ -113,6 +126,13 @@ void DescendantInvalidationSet::addTagName(const AtomicString& tagName)
ensureTagNameSet().add(tagName);
}
+void DescendantInvalidationSet::addAttribute(const AtomicString& attribute)
+{
+ if (wholeSubtreeInvalid())
+ return;
+ ensureAttributeSet().add(attribute);
+}
+
void DescendantInvalidationSet::getClasses(Vector<AtomicString>& classes) const
{
if (!m_classes)
@@ -121,6 +141,14 @@ void DescendantInvalidationSet::getClasses(Vector<AtomicString>& classes) const
classes.append(*it);
}
+void DescendantInvalidationSet::getAttributes(Vector<AtomicString>& attributes) const
+{
+ if (!m_attributes)
+ return;
+ for (HashSet<AtomicString>::const_iterator it = m_attributes->begin(); it != m_attributes->end(); ++it)
+ attributes.append(*it);
+}
+
void DescendantInvalidationSet::setWholeSubtreeInvalid()
{
if (m_allDescendantsMightBeInvalid)
@@ -130,6 +158,7 @@ void DescendantInvalidationSet::setWholeSubtreeInvalid()
m_classes = nullptr;
m_ids = nullptr;
m_tagNames = nullptr;
+ m_attributes = nullptr;
}
} // namespace WebCore
« no previous file with comments | « Source/core/css/analyzer/DescendantInvalidationSet.h ('k') | Source/core/css/invalidation/StyleInvalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698