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

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

Issue 149513011: Pass around CSSSelector by reference instead of pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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/SelectorFilter.h ('k') | Source/core/css/StyleInvalidationAnalysis.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/SelectorFilter.cpp
diff --git a/Source/core/css/SelectorFilter.cpp b/Source/core/css/SelectorFilter.cpp
index 50d13de6b484eb6b674dec0f98941480778cc008..352ae8fd6464a1701062d21e5266baa370b88638 100644
--- a/Source/core/css/SelectorFilter.cpp
+++ b/Source/core/css/SelectorFilter.cpp
@@ -108,41 +108,41 @@ void SelectorFilter::pushParent(Element& parent)
pushParentStackFrame(parent);
}
-static inline void collectDescendantSelectorIdentifierHashes(const CSSSelector* selector, unsigned*& hash)
+static inline void collectDescendantSelectorIdentifierHashes(const CSSSelector& selector, unsigned*& hash)
{
- switch (selector->m_match) {
+ switch (selector.m_match) {
case CSSSelector::Id:
- if (!selector->value().isEmpty())
- (*hash++) = selector->value().impl()->existingHash() * IdAttributeSalt;
+ if (!selector.value().isEmpty())
+ (*hash++) = selector.value().impl()->existingHash() * IdAttributeSalt;
break;
case CSSSelector::Class:
- if (!selector->value().isEmpty())
- (*hash++) = selector->value().impl()->existingHash() * ClassAttributeSalt;
+ if (!selector.value().isEmpty())
+ (*hash++) = selector.value().impl()->existingHash() * ClassAttributeSalt;
break;
case CSSSelector::Tag:
- if (selector->tagQName().localName() != starAtom)
- (*hash++) = selector->tagQName().localName().impl()->existingHash() * TagNameSalt;
+ if (selector.tagQName().localName() != starAtom)
+ (*hash++) = selector.tagQName().localName().impl()->existingHash() * TagNameSalt;
break;
default:
break;
}
}
-void SelectorFilter::collectIdentifierHashes(const CSSSelector* selector, unsigned* identifierHashes, unsigned maximumIdentifierCount)
+void SelectorFilter::collectIdentifierHashes(const CSSSelector& selector, unsigned* identifierHashes, unsigned maximumIdentifierCount)
{
unsigned* hash = identifierHashes;
unsigned* end = identifierHashes + maximumIdentifierCount;
- CSSSelector::Relation relation = selector->relation();
- bool relationIsAffectedByPseudoContent = selector->relationIsAffectedByPseudoContent();
+ CSSSelector::Relation relation = selector.relation();
+ bool relationIsAffectedByPseudoContent = selector.relationIsAffectedByPseudoContent();
// Skip the topmost selector. It is handled quickly by the rule hashes.
bool skipOverSubselectors = true;
- for (selector = selector->tagHistory(); selector; selector = selector->tagHistory()) {
+ for (const CSSSelector* current = selector.tagHistory(); current; current = current->tagHistory()) {
// Only collect identifiers that match ancestors.
switch (relation) {
case CSSSelector::SubSelector:
if (!skipOverSubselectors)
- collectDescendantSelectorIdentifierHashes(selector, hash);
+ collectDescendantSelectorIdentifierHashes(*current, hash);
break;
case CSSSelector::DirectAdjacent:
case CSSSelector::IndirectAdjacent:
@@ -160,13 +160,13 @@ void SelectorFilter::collectIdentifierHashes(const CSSSelector* selector, unsign
case CSSSelector::ChildTree:
case CSSSelector::DescendantTree:
skipOverSubselectors = false;
- collectDescendantSelectorIdentifierHashes(selector, hash);
+ collectDescendantSelectorIdentifierHashes(*current, hash);
break;
}
if (hash == end)
return;
- relation = selector->relation();
- relationIsAffectedByPseudoContent = selector->relationIsAffectedByPseudoContent();
+ relation = current->relation();
+ relationIsAffectedByPseudoContent = current->relationIsAffectedByPseudoContent();
}
*hash = 0;
}
« no previous file with comments | « Source/core/css/SelectorFilter.h ('k') | Source/core/css/StyleInvalidationAnalysis.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698