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

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

Issue 1149913008: Compute the linkMatchType inside the CSSSelectorParser. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | « no previous file | Source/core/css/CSSSelector.cpp » ('j') | Source/core/css/parser/CSSSelectorParser.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSSelector.h
diff --git a/Source/core/css/CSSSelector.h b/Source/core/css/CSSSelector.h
index a787c3647b947457c07250392cb6e75cb352368e..6932ca13fc11b0ba5c18eb91c82e4bc7d409012d 100644
--- a/Source/core/css/CSSSelector.h
+++ b/Source/core/css/CSSSelector.h
@@ -296,8 +296,11 @@ namespace blink {
// http://dev.w3.org/csswg/selectors4/#compound
bool isCompound() const;
+ // Note: the link match type is only valid for the start of each selector
+ // in a CSSSelectorList.
enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLink | MatchVisited };
- unsigned computeLinkMatchType() const;
+ void updateLinkMatchType();
+ unsigned linkMatchType() const { return m_linkMatchType; }
bool isForPage() const { return m_isForPage; }
void setForPage() { m_isForPage = true; }
@@ -306,15 +309,16 @@ namespace blink {
void setRelationIsAffectedByPseudoContent() { m_relationIsAffectedByPseudoContent = true; }
private:
- unsigned m_relation : 3; // enum Relation
- mutable unsigned m_match : 4; // enum Match
- mutable unsigned m_pseudoType : 8; // PseudoType
+ unsigned m_relation : 3; // enum Relation
+ unsigned m_match : 4; // enum Match
+ unsigned m_pseudoType : 8; // PseudoType
unsigned m_isLastInSelectorList : 1;
unsigned m_isLastInTagHistory : 1;
unsigned m_hasRareData : 1;
unsigned m_isForPage : 1;
unsigned m_tagIsImplicit : 1;
unsigned m_relationIsAffectedByPseudoContent : 1;
+ unsigned m_linkMatchType : 2; // LinkMatchMask
void setPseudoType(PseudoType pseudoType)
{
@@ -417,6 +421,7 @@ inline CSSSelector::CSSSelector()
, m_isForPage(false)
, m_tagIsImplicit(false)
, m_relationIsAffectedByPseudoContent(false)
+ , m_linkMatchType(MatchAll)
{
}
@@ -430,6 +435,7 @@ inline CSSSelector::CSSSelector(const QualifiedName& tagQName, bool tagIsImplici
, m_isForPage(false)
, m_tagIsImplicit(tagIsImplicit)
, m_relationIsAffectedByPseudoContent(false)
+ , m_linkMatchType(MatchAll)
{
m_data.m_tagQName = tagQName.impl();
m_data.m_tagQName->ref();
@@ -445,6 +451,7 @@ inline CSSSelector::CSSSelector(const CSSSelector& o)
, m_isForPage(o.m_isForPage)
, m_tagIsImplicit(o.m_tagIsImplicit)
, m_relationIsAffectedByPseudoContent(o.m_relationIsAffectedByPseudoContent)
+ , m_linkMatchType(MatchAll)
{
if (o.m_match == Tag) {
m_data.m_tagQName = o.m_data.m_tagQName;
« no previous file with comments | « no previous file | Source/core/css/CSSSelector.cpp » ('j') | Source/core/css/parser/CSSSelectorParser.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698