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

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

Issue 212603002: RuleFeatures argument list cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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') | no next file » | 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 b5dc017d657c25ba94f3434040e6d60f3b7bc5ed..2051884773cd63df1827145f1842218a626c530d 100644
--- a/Source/core/css/RuleFeature.cpp
+++ b/Source/core/css/RuleFeature.cpp
@@ -141,16 +141,16 @@ RuleFeatureSet::InvalidationSetMode RuleFeatureSet::supportsClassDescendantInval
return foundIdent ? AddFeatures : UseLocalStyleChange;
}
-void extractClassIdTagOrAttribute(const CSSSelector& selector, Vector<AtomicString>& classes, AtomicString& id, AtomicString& tagName, Vector<AtomicString>& attributes)
+void RuleFeatureSet::extractInvalidationSetFeature(const CSSSelector& selector, InvalidationSetFeatures& features)
{
if (selector.m_match == CSSSelector::Tag)
- tagName = selector.tagQName().localName();
+ features.tagName = selector.tagQName().localName();
else if (selector.m_match == CSSSelector::Id)
- id = selector.value();
+ features.id = selector.value();
else if (selector.m_match == CSSSelector::Class)
- classes.append(selector.value());
+ features.classes.append(selector.value());
else if (selector.isAttributeSelector())
- attributes.append(selector.attribute().localName());
+ features.attributes.append(selector.attribute().localName());
}
RuleFeatureSet::RuleFeatureSet()
@@ -173,31 +173,27 @@ RuleFeatureSet::InvalidationSetMode RuleFeatureSet::updateInvalidationSets(const
if (mode != AddFeatures)
return mode;
- Vector<AtomicString> classes;
- AtomicString id;
- AtomicString tagName;
- Vector<AtomicString> attributes;
-
- const CSSSelector* current = extractInvalidationSetFeatures(selector, classes, id, tagName, attributes);
+ InvalidationSetFeatures features;
+ const CSSSelector* current = extractInvalidationSetFeatures(selector, features);
if (current)
current = current->tagHistory();
if (current)
- addFeaturesToInvalidationSets(*current, classes, id, tagName, attributes);
+ addFeaturesToInvalidationSets(*current, features);
return AddFeatures;
}
-const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelector& selector, Vector<AtomicString>& classes, AtomicString& id, AtomicString& tagName, Vector<AtomicString>& attributes)
+const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelector& selector, InvalidationSetFeatures& features)
{
const CSSSelector* lastSelector = &selector;
for (; lastSelector; lastSelector = lastSelector->tagHistory()) {
- extractClassIdTagOrAttribute(*lastSelector, classes, id, tagName, attributes);
+ extractInvalidationSetFeature(*lastSelector, features);
// Initialize the entry in the invalidation set map, if supported.
invalidationSetForSelector(*lastSelector);
if (lastSelector->pseudoType() == CSSSelector::PseudoHost) {
if (const CSSSelectorList* selectorList = lastSelector->selectorList()) {
for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(*selector))
- extractInvalidationSetFeatures(*selector, classes, id, tagName, attributes);
+ extractInvalidationSetFeatures(*selector, features);
}
}
@@ -207,22 +203,22 @@ const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelec
return lastSelector;
}
-void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector, const Vector<AtomicString>& classes, AtomicString id, AtomicString tagName, const Vector<AtomicString>& attributes)
+void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector, const InvalidationSetFeatures& features)
{
for (const CSSSelector* current = &selector; current; current = current->tagHistory()) {
if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelector(*current)) {
- if (!id.isEmpty())
- invalidationSet->addId(id);
- if (!tagName.isEmpty())
- invalidationSet->addTagName(tagName);
- for (Vector<AtomicString>::const_iterator it = classes.begin(); it != classes.end(); ++it)
+ if (!features.id.isEmpty())
+ invalidationSet->addId(features.id);
+ if (!features.tagName.isEmpty())
+ invalidationSet->addTagName(features.tagName);
+ for (Vector<AtomicString>::const_iterator it = features.classes.begin(); it != features.classes.end(); ++it)
invalidationSet->addClass(*it);
- for (Vector<AtomicString>::const_iterator it = attributes.begin(); it != attributes.end(); ++it)
+ for (Vector<AtomicString>::const_iterator it = features.attributes.begin(); it != features.attributes.end(); ++it)
invalidationSet->addAttribute(*it);
} else if (current->pseudoType() == CSSSelector::PseudoHost) {
if (const CSSSelectorList* selectorList = current->selectorList()) {
for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(*selector))
- addFeaturesToInvalidationSets(*selector, classes, id, tagName, attributes);
+ addFeaturesToInvalidationSets(*selector, features);
}
}
}
« no previous file with comments | « Source/core/css/RuleFeature.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698