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

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

Issue 1149913008: Compute the linkMatchType inside the CSSSelectorParser. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Do it inside consumeComplexSelector. Created 5 years, 7 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/CSSSelector.h ('k') | Source/core/css/RuleSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSSelector.cpp
diff --git a/Source/core/css/CSSSelector.cpp b/Source/core/css/CSSSelector.cpp
index 901343b96cec615c663eb461dc23f542a204d604..a5723f0fea2225de06faea615c2f3ed4a04fa39e 100644
--- a/Source/core/css/CSSSelector.cpp
+++ b/Source/core/css/CSSSelector.cpp
@@ -853,10 +853,8 @@ bool CSSSelector::isCompound() const
return true;
}
-unsigned CSSSelector::computeLinkMatchType() const
+void CSSSelector::updateLinkMatchType()
{
- unsigned linkMatchType = MatchAll;
-
// Determine if this selector will match a link in visited, unvisited or any state, or never.
// :visited never matches other elements than the innermost link element.
for (const CSSSelector* current = this; current; current = current->tagHistory()) {
@@ -868,17 +866,17 @@ unsigned CSSSelector::computeLinkMatchType() const
for (const CSSSelector* subSelector = current->selectorList()->first(); subSelector; subSelector = subSelector->tagHistory()) {
PseudoType subType = subSelector->pseudoType();
if (subType == PseudoVisited)
- linkMatchType &= ~MatchVisited;
+ m_linkMatchType &= ~MatchVisited;
else if (subType == PseudoLink)
- linkMatchType &= ~MatchLink;
+ m_linkMatchType &= ~MatchLink;
}
}
break;
case PseudoLink:
- linkMatchType &= ~MatchVisited;
+ m_linkMatchType &= ~MatchVisited;
break;
case PseudoVisited:
- linkMatchType &= ~MatchLink;
+ m_linkMatchType &= ~MatchLink;
break;
default:
// We don't support :link and :visited inside :-webkit-any.
@@ -888,11 +886,10 @@ unsigned CSSSelector::computeLinkMatchType() const
if (relation == SubSelector)
continue;
if (relation != Descendant && relation != Child)
- return linkMatchType;
- if (linkMatchType != MatchAll)
- return linkMatchType;
+ return;
+ if (m_linkMatchType != MatchAll)
+ return;
}
- return linkMatchType;
}
void CSSSelector::setNth(int a, int b)
« no previous file with comments | « Source/core/css/CSSSelector.h ('k') | Source/core/css/RuleSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698