Title: [173569] trunk/Source/WebCore
Revision
173569
Author
[email protected]
Date
2014-09-12 12:24:12 -0700 (Fri, 12 Sep 2014)

Log Message

Make all CSSSelector data members private
https://bugs.webkit.org/show_bug.cgi?id=136784

Reviewed by Benjamin Poulain.

Make all CSSSelector data members private. Previously, some of the data
members such as m_relation / m_match / m_pseudoType were public and
accessed directly from outside the class. The new approach is better
because:
- Those members are bit fields so by using getters, we can hide the
  casts inside the getters. The setters can now also check that the
  bitfield is big enough to actually store the enum value.
- When using those in switch() statements, the compiler now complains
  if we fail to test some of the enum values as the value is now an
  enum, and not merely an unsigned integer.
- Some of these members already has getters (e.g. relation()).
- Better encapsulation.

No new tests, no behavior change.

* css/CSSParserValues.cpp:
(WebCore::CSSParserSelector::parsePagePseudoSelector):
(WebCore::CSSParserSelector::parsePseudoElementSelector):
(WebCore::CSSParserSelector::parsePseudoElementCueFunctionSelector):
(WebCore::CSSParserSelector::parsePseudoClassAndCompatibilityElementSelector):
(WebCore::CSSParserSelector::setPseudoClassValue):
(WebCore::CSSParserSelector::isSimple):
(WebCore::CSSParserSelector::prependTagSelector):
* css/CSSParserValues.h:
(WebCore::CSSParserSelector::setMatch):
(WebCore::CSSParserSelector::setRelation):
(WebCore::CSSParserSelector::isPseudoElementCueFunction):
* css/CSSSelector.cpp:
(WebCore::CSSSelector::createRareData):
(WebCore::CSSSelector::specificityForOneSelector):
(WebCore::CSSSelector::specificityForPage):
(WebCore::CSSSelector::operator==):
(WebCore::CSSSelector::selectorText):
* css/CSSSelector.h:
(WebCore::CSSSelector::setPseudoElementType):
(WebCore::CSSSelector::setPagePseudoType):
(WebCore::CSSSelector::pseudoClassType):
(WebCore::CSSSelector::setPseudoClassType):
(WebCore::CSSSelector::pseudoElementType):
(WebCore::CSSSelector::pagePseudoClassType):
(WebCore::CSSSelector::setRelation):
(WebCore::CSSSelector::match):
(WebCore::CSSSelector::setMatch):
(WebCore::CSSSelector::matchesPseudoElement):
(WebCore::CSSSelector::isUnknownPseudoElement):
(WebCore::CSSSelector::isCustomPseudoElement):
(WebCore::CSSSelector::isSiblingSelector):
(WebCore::CSSSelector::isAttributeSelector):
(WebCore::CSSSelector::setValue):
(WebCore::CSSSelector::CSSSelector):
(WebCore::CSSSelector::~CSSSelector):
(WebCore::CSSSelector::tagQName):
(WebCore::CSSSelector::value):
* css/CSSSelectorList.cpp:
(WebCore::SelectorNeedsNamespaceResolutionFunctor::operator()):
* css/PageRuleCollector.cpp:
(WebCore::checkPageSelectorComponents):
* css/RuleFeature.cpp:
(WebCore::RuleFeatureSet::collectFeaturesFromSelector):
* css/RuleSet.cpp:
(WebCore::isSelectorMatchingHTMLBasedOnRuleHash):
(WebCore::determinePropertyWhitelistType):
(WebCore::RuleSet::addRule):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively):
(WebCore::anyAttributeMatches):
(WebCore::canMatchHoverOrActiveInQuirksMode):
(WebCore::SelectorChecker::checkOne):
(WebCore::SelectorChecker::checkScrollbarPseudoClass):
(WebCore::SelectorChecker::determineLinkMatchType):
* css/SelectorChecker.h:
(WebCore::SelectorChecker::isCommonPseudoClassSelector):
* css/SelectorFilter.cpp:
(WebCore::collectDescendantSelectorIdentifierHashes):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::constructFragments):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueMatching):
* dom/SelectorQuery.cpp:
(WebCore::isSingleTagNameSelector):
(WebCore::isSingleClassNameSelector):
(WebCore::findIdMatchingType):
(WebCore::SelectorDataList::SelectorDataList):
(WebCore::selectorForIdLookup):
(WebCore::filterRootById):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173568 => 173569)


--- trunk/Source/WebCore/ChangeLog	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/ChangeLog	2014-09-12 19:24:12 UTC (rev 173569)
@@ -1,3 +1,96 @@
+2014-09-12  Chris Dumez  <[email protected]>
+
+        Make all CSSSelector data members private
+        https://bugs.webkit.org/show_bug.cgi?id=136784
+
+        Reviewed by Benjamin Poulain.
+
+        Make all CSSSelector data members private. Previously, some of the data
+        members such as m_relation / m_match / m_pseudoType were public and
+        accessed directly from outside the class. The new approach is better
+        because:
+        - Those members are bit fields so by using getters, we can hide the
+          casts inside the getters. The setters can now also check that the
+          bitfield is big enough to actually store the enum value.
+        - When using those in switch() statements, the compiler now complains
+          if we fail to test some of the enum values as the value is now an
+          enum, and not merely an unsigned integer.
+        - Some of these members already has getters (e.g. relation()).
+        - Better encapsulation.
+
+        No new tests, no behavior change.
+
+        * css/CSSParserValues.cpp:
+        (WebCore::CSSParserSelector::parsePagePseudoSelector):
+        (WebCore::CSSParserSelector::parsePseudoElementSelector):
+        (WebCore::CSSParserSelector::parsePseudoElementCueFunctionSelector):
+        (WebCore::CSSParserSelector::parsePseudoClassAndCompatibilityElementSelector):
+        (WebCore::CSSParserSelector::setPseudoClassValue):
+        (WebCore::CSSParserSelector::isSimple):
+        (WebCore::CSSParserSelector::prependTagSelector):
+        * css/CSSParserValues.h:
+        (WebCore::CSSParserSelector::setMatch):
+        (WebCore::CSSParserSelector::setRelation):
+        (WebCore::CSSParserSelector::isPseudoElementCueFunction):
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::createRareData):
+        (WebCore::CSSSelector::specificityForOneSelector):
+        (WebCore::CSSSelector::specificityForPage):
+        (WebCore::CSSSelector::operator==):
+        (WebCore::CSSSelector::selectorText):
+        * css/CSSSelector.h:
+        (WebCore::CSSSelector::setPseudoElementType):
+        (WebCore::CSSSelector::setPagePseudoType):
+        (WebCore::CSSSelector::pseudoClassType):
+        (WebCore::CSSSelector::setPseudoClassType):
+        (WebCore::CSSSelector::pseudoElementType):
+        (WebCore::CSSSelector::pagePseudoClassType):
+        (WebCore::CSSSelector::setRelation):
+        (WebCore::CSSSelector::match):
+        (WebCore::CSSSelector::setMatch):
+        (WebCore::CSSSelector::matchesPseudoElement):
+        (WebCore::CSSSelector::isUnknownPseudoElement):
+        (WebCore::CSSSelector::isCustomPseudoElement):
+        (WebCore::CSSSelector::isSiblingSelector):
+        (WebCore::CSSSelector::isAttributeSelector):
+        (WebCore::CSSSelector::setValue):
+        (WebCore::CSSSelector::CSSSelector):
+        (WebCore::CSSSelector::~CSSSelector):
+        (WebCore::CSSSelector::tagQName):
+        (WebCore::CSSSelector::value):
+        * css/CSSSelectorList.cpp:
+        (WebCore::SelectorNeedsNamespaceResolutionFunctor::operator()):
+        * css/PageRuleCollector.cpp:
+        (WebCore::checkPageSelectorComponents):
+        * css/RuleFeature.cpp:
+        (WebCore::RuleFeatureSet::collectFeaturesFromSelector):
+        * css/RuleSet.cpp:
+        (WebCore::isSelectorMatchingHTMLBasedOnRuleHash):
+        (WebCore::determinePropertyWhitelistType):
+        (WebCore::RuleSet::addRule):
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::matchRecursively):
+        (WebCore::anyAttributeMatches):
+        (WebCore::canMatchHoverOrActiveInQuirksMode):
+        (WebCore::SelectorChecker::checkOne):
+        (WebCore::SelectorChecker::checkScrollbarPseudoClass):
+        (WebCore::SelectorChecker::determineLinkMatchType):
+        * css/SelectorChecker.h:
+        (WebCore::SelectorChecker::isCommonPseudoClassSelector):
+        * css/SelectorFilter.cpp:
+        (WebCore::collectDescendantSelectorIdentifierHashes):
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::constructFragments):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeMatching):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueMatching):
+        * dom/SelectorQuery.cpp:
+        (WebCore::isSingleTagNameSelector):
+        (WebCore::isSingleClassNameSelector):
+        (WebCore::findIdMatchingType):
+        (WebCore::SelectorDataList::SelectorDataList):
+        (WebCore::selectorForIdLookup):
+        (WebCore::filterRootById):
+
 2014-09-12  Carlos Garcia Campos  <[email protected]>
 
         REGRESSION(r173441): [GTK] All buttons appear insensitive

Modified: trunk/Source/WebCore/css/CSSParserValues.cpp (173568 => 173569)


--- trunk/Source/WebCore/css/CSSParserValues.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/CSSParserValues.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -167,7 +167,7 @@
         return nullptr;
 
     auto selector = std::make_unique<CSSParserSelector>();
-    selector->m_selector->m_match = CSSSelector::PagePseudoClass;
+    selector->m_selector->setMatch(CSSSelector::PagePseudoClass);
     selector->m_selector->setPagePseudoType(pseudoType);
     return selector.release();
 }
@@ -182,7 +182,7 @@
         return nullptr;
 
     auto selector = std::make_unique<CSSParserSelector>();
-    selector->m_selector->m_match = CSSSelector::PseudoElement;
+    selector->m_selector->setMatch(CSSSelector::PseudoElement);
     selector->m_selector->setPseudoElementType(pseudoType);
     selector->m_selector->setValue(name);
     return selector.release();
@@ -199,7 +199,7 @@
         return nullptr;
 
     auto selector = std::make_unique<CSSParserSelector>();
-    selector->m_selector->m_match = CSSSelector::PseudoElement;
+    selector->m_selector->setMatch(CSSSelector::PseudoElement);
     selector->m_selector->setPseudoElementType(CSSSelector::PseudoElementCue);
     selector->adoptSelectorVector(*selectorVector);
     return selector.release();
@@ -211,13 +211,13 @@
     PseudoClassOrCompatibilityPseudoElement pseudoType = parsePseudoClassAndCompatibilityElementString(pseudoTypeString);
     if (pseudoType.pseudoClass != CSSSelector::PseudoClassUnknown) {
         auto selector = std::make_unique<CSSParserSelector>();
-        selector->m_selector->m_match = CSSSelector::PseudoClass;
-        selector->m_selector->m_pseudoType = pseudoType.pseudoClass;
+        selector->m_selector->setMatch(CSSSelector::PseudoClass);
+        selector->m_selector->setPseudoClassType(pseudoType.pseudoClass);
         return selector.release();
     }
     if (pseudoType.compatibilityPseudoElement != CSSSelector::PseudoElementUnknown) {
         auto selector = std::make_unique<CSSParserSelector>();
-        selector->m_selector->m_match = CSSSelector::PseudoElement;
+        selector->m_selector->setMatch(CSSSelector::PseudoElement);
         selector->m_selector->setPseudoElementType(pseudoType.compatibilityPseudoElement);
         AtomicString name = pseudoTypeString;
         selector->m_selector->setValue(name);
@@ -260,10 +260,10 @@
 
 void CSSParserSelector::setPseudoClassValue(const CSSParserString& pseudoClassString)
 {
-    ASSERT(m_selector->m_match == CSSSelector::PseudoClass);
+    ASSERT(m_selector->match() == CSSSelector::PseudoClass);
 
     PseudoClassOrCompatibilityPseudoElement pseudoType = parsePseudoClassAndCompatibilityElementString(pseudoClassString);
-    m_selector->m_pseudoType = pseudoType.pseudoClass;
+    m_selector->setPseudoClassType(pseudoType.pseudoClass);
 }
 
 bool CSSParserSelector::isSimple() const
@@ -274,7 +274,7 @@
     if (!m_tagHistory)
         return true;
 
-    if (m_selector->m_match == CSSSelector::Tag) {
+    if (m_selector->match() == CSSSelector::Tag) {
         // We can't check against anyQName() here because namespace may not be nullAtom.
         // Example:
         //     @namespace "http://www.w3.org/2000/svg";
@@ -312,7 +312,7 @@
     m_tagHistory = WTF::move(second);
 
     m_selector = std::make_unique<CSSSelector>(tagQName, tagIsForNamespaceRule);
-    m_selector->m_relation = CSSSelector::SubSelector;
+    m_selector->setRelation(CSSSelector::SubSelector);
 }
 
 }

Modified: trunk/Source/WebCore/css/CSSParserValues.h (173568 => 173569)


--- trunk/Source/WebCore/css/CSSParserValues.h	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/CSSParserValues.h	2014-09-12 19:24:12 UTC (rev 173569)
@@ -195,8 +195,8 @@
     void setValue(const AtomicString& value) { m_selector->setValue(value); }
     void setAttribute(const QualifiedName& value, bool isCaseInsensitive) { m_selector->setAttribute(value, isCaseInsensitive); }
     void setArgument(const AtomicString& value) { m_selector->setArgument(value); }
-    void setMatch(CSSSelector::Match value) { m_selector->m_match = value; }
-    void setRelation(CSSSelector::Relation value) { m_selector->m_relation = value; }
+    void setMatch(CSSSelector::Match value) { m_selector->setMatch(value); }
+    void setRelation(CSSSelector::Relation value) { m_selector->setRelation(value); }
     void setForPage() { m_selector->setForPage(); }
 
 
@@ -209,7 +209,7 @@
     bool isPseudoElementCueFunction() const
     {
 #if ENABLE(VIDEO_TRACK)
-        return m_selector->m_match == CSSSelector::PseudoElement && m_selector->pseudoElementType() == CSSSelector::PseudoElementCue;
+        return m_selector->match() == CSSSelector::PseudoElement && m_selector->pseudoElementType() == CSSSelector::PseudoElementCue;
 #else
         return false;
 #endif

Modified: trunk/Source/WebCore/css/CSSSelector.cpp (173568 => 173569)


--- trunk/Source/WebCore/css/CSSSelector.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/CSSSelector.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -44,7 +44,7 @@
 
 void CSSSelector::createRareData()
 {
-    ASSERT(m_match != Tag);
+    ASSERT(match() != Tag);
     if (m_hasRareData)
         return;
     // Move the value to the rare data stucture.
@@ -85,10 +85,12 @@
 {
     // FIXME: Pseudo-elements and pseudo-classes do not have the same specificity. This function
     // isn't quite correct.
-    switch (m_match) {
+    switch (match()) {
     case Id:
         return 0x10000;
 
+    case PagePseudoClass:
+        break;
     case PseudoClass:
         // FIXME: PsuedoAny should base the specificity on the sub-selectors.
         // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0530.html
@@ -105,7 +107,6 @@
     case Begin:
     case End:
         return 0x100;
-
     case Tag:
         return (tagQName().localName() != starAtom) ? 1 : 0;
     case Unknown:
@@ -121,7 +122,7 @@
     unsigned s = 0;
 
     for (const CSSSelector* component = this; component; component = component->tagHistory()) {
-        switch (component->m_match) {
+        switch (component->match()) {
         case Tag:
             s += tagQName().localName() == starAtom ? 0 : 4;
             break;
@@ -208,13 +209,13 @@
     while (sel1 && sel2) {
         if (sel1->attribute() != sel2->attribute()
             || sel1->relation() != sel2->relation()
-            || sel1->m_match != sel2->m_match
+            || sel1->match() != sel2->match()
             || sel1->value() != sel2->value()
             || sel1->m_pseudoType != sel2->m_pseudoType
             || sel1->argument() != sel2->argument()) {
             return false;
         }
-        if (sel1->m_match == Tag) {
+        if (sel1->match() == Tag) {
             if (sel1->tagQName() != sel2->tagQName())
                 return false;
         }
@@ -249,7 +250,7 @@
 {
     StringBuilder str;
 
-    if (m_match == CSSSelector::Tag && !m_tagIsForNamespaceRule) {
+    if (match() == CSSSelector::Tag && !m_tagIsForNamespaceRule) {
         if (tagQName().prefix().isNull())
             str.append(tagQName().localName());
         else {
@@ -261,13 +262,13 @@
 
     const CSSSelector* cs = this;
     while (true) {
-        if (cs->m_match == CSSSelector::Id) {
+        if (cs->match() == CSSSelector::Id) {
             str.append('#');
             serializeIdentifier(cs->value(), str);
-        } else if (cs->m_match == CSSSelector::Class) {
+        } else if (cs->match() == CSSSelector::Class) {
             str.append('.');
             serializeIdentifier(cs->value(), str);
-        } else if (cs->m_match == CSSSelector::PseudoClass) {
+        } else if (cs->match() == CSSSelector::PseudoClass) {
             switch (cs->pseudoClassType()) {
 #if ENABLE(FULLSCREEN_API)
             case CSSSelector::PseudoClassAnimatingFullScreenTransition:
@@ -469,7 +470,7 @@
             case CSSSelector::PseudoClassUnknown:
                 ASSERT_NOT_REACHED();
             }
-        } else if (cs->m_match == CSSSelector::PseudoElement) {
+        } else if (cs->match() == CSSSelector::PseudoElement) {
             str.appendLiteral("::");
             str.append(cs->value());
         } else if (cs->isAttributeSelector()) {
@@ -480,7 +481,7 @@
                 str.append('|');
             }
             str.append(cs->attribute().localName());
-            switch (cs->m_match) {
+            switch (cs->match()) {
                 case CSSSelector::Exact:
                     str.append('=');
                     break;
@@ -506,11 +507,11 @@
                 default:
                     break;
             }
-            if (cs->m_match != CSSSelector::Set) {
+            if (cs->match() != CSSSelector::Set) {
                 serializeString(cs->value(), str);
                 str.append(']');
             }
-        } else if (cs->m_match == CSSSelector::PagePseudoClass) {
+        } else if (cs->match() == CSSSelector::PagePseudoClass) {
             switch (cs->pagePseudoClassType()) {
             case PagePseudoClassFirst:
                 str.appendLiteral(":first");

Modified: trunk/Source/WebCore/css/CSSSelector.h (173568 => 173569)


--- trunk/Source/WebCore/css/CSSSelector.h	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/CSSSelector.h	2014-09-12 19:24:12 UTC (rev 173569)
@@ -205,8 +205,6 @@
         const AtomicString& argument() const { return m_hasRareData ? m_data.m_rareData->m_argument : nullAtom; }
         const CSSSelectorList* selectorList() const { return m_hasRareData ? m_data.m_rareData->m_selectorList.get() : 0; }
 
-        void setPseudoElementType(PseudoElementType pseudoElementType) { m_pseudoType = pseudoElementType; }
-        void setPagePseudoType(PagePseudoClassType pagePseudoType) { m_pseudoType = pagePseudoType; }
         void setValue(const AtomicString&);
         void setAttribute(const QualifiedName&, bool isCaseInsensitive);
         void setArgument(const AtomicString&);
@@ -219,21 +217,36 @@
 
         PseudoClassType pseudoClassType() const
         {
-            ASSERT(m_match == PseudoClass);
+            ASSERT(match() == PseudoClass);
             return static_cast<PseudoClassType>(m_pseudoType);
         }
+        void setPseudoClassType(PseudoClassType pseudoType)
+        {
+            m_pseudoType = pseudoType;
+            ASSERT(m_pseudoType == pseudoType);
+        }
 
         PseudoElementType pseudoElementType() const
         {
-            ASSERT(m_match == PseudoElement);
+            ASSERT(match() == PseudoElement);
             return static_cast<PseudoElementType>(m_pseudoType);
         }
+        void setPseudoElementType(PseudoElementType pseudoElementType)
+        {
+            m_pseudoType = pseudoElementType;
+            ASSERT(m_pseudoType == pseudoElementType);
+        }
 
         PagePseudoClassType pagePseudoClassType() const
         {
-            ASSERT(m_match == PagePseudoClass);
+            ASSERT(match() == PagePseudoClass);
             return static_cast<PagePseudoClassType>(m_pseudoType);
         }
+        void setPagePseudoType(PagePseudoClassType pagePseudoType)
+        {
+            m_pseudoType = pagePseudoType;
+            ASSERT(m_pseudoType == pagePseudoType);
+        }
 
         bool matchesPseudoElement() const;
         bool isUnknownPseudoElement() const;
@@ -242,7 +255,19 @@
         bool isAttributeSelector() const;
 
         Relation relation() const { return static_cast<Relation>(m_relation); }
+        void setRelation(Relation relation)
+        {
+            m_relation = relation;
+            ASSERT(m_relation == relation);
+        }
 
+        Match match() const { return static_cast<Match>(m_match); }
+        void setMatch(Match match)
+        {
+            m_match = match;
+            ASSERT(m_match == match);
+        }
+
         bool isLastInSelectorList() const { return m_isLastInSelectorList; }
         void setLastInSelectorList() { m_isLastInSelectorList = true; }
         bool isLastInTagHistory() const { return m_isLastInTagHistory; }
@@ -253,11 +278,10 @@
         bool isForPage() const { return m_isForPage; }
         void setForPage() { m_isForPage = true; }
 
+    private:
         unsigned m_relation           : 3; // enum Relation
         mutable unsigned m_match      : 4; // enum Match
         mutable unsigned m_pseudoType : 8; // PseudoType
-
-    private:
         mutable bool m_parsedNth      : 1; // Used for :nth-*
         bool m_isLastInSelectorList   : 1;
         bool m_isLastInTagHistory     : 1;
@@ -315,17 +339,17 @@
 
 inline bool CSSSelector::matchesPseudoElement() const
 {
-    return m_match == PseudoElement;
+    return match() == PseudoElement;
 }
 
 inline bool CSSSelector::isUnknownPseudoElement() const
 {
-    return m_match == PseudoElement && m_pseudoType == PseudoElementUnknown;
+    return match() == PseudoElement && pseudoElementType() == PseudoElementUnknown;
 }
 
 inline bool CSSSelector::isCustomPseudoElement() const
 {
-    return m_match == PseudoElement && (m_pseudoType == PseudoElementUserAgentCustom || m_pseudoType == PseudoElementWebKitCustom);
+    return match() == PseudoElement && (pseudoElementType() == PseudoElementUserAgentCustom || pseudoElementType() == PseudoElementWebKitCustom);
 }
 
 static inline bool pseudoClassIsRelativeToSiblings(CSSSelector::PseudoClassType type)
@@ -345,25 +369,25 @@
 
 inline bool CSSSelector::isSiblingSelector() const
 {
-    return m_relation == DirectAdjacent
-        || m_relation == IndirectAdjacent
-        || (m_match == CSSSelector::PseudoClass && pseudoClassIsRelativeToSiblings(pseudoClassType()));
+    return relation() == DirectAdjacent
+        || relation() == IndirectAdjacent
+        || (match() == CSSSelector::PseudoClass && pseudoClassIsRelativeToSiblings(pseudoClassType()));
 }
 
 inline bool CSSSelector::isAttributeSelector() const
 {
-    return m_match == CSSSelector::Exact
-        || m_match ==  CSSSelector::Set
-        || m_match == CSSSelector::List
-        || m_match == CSSSelector::Hyphen
-        || m_match == CSSSelector::Contain
-        || m_match == CSSSelector::Begin
-        || m_match == CSSSelector::End;
+    return match() == CSSSelector::Exact
+        || match() ==  CSSSelector::Set
+        || match() == CSSSelector::List
+        || match() == CSSSelector::Hyphen
+        || match() == CSSSelector::Contain
+        || match() == CSSSelector::Begin
+        || match() == CSSSelector::End;
 }
 
 inline void CSSSelector::setValue(const AtomicString& value)
 {
-    ASSERT(m_match != Tag);
+    ASSERT(match() != Tag);
     // Need to do ref counting manually for the union.
     if (m_hasRareData) {
         if (m_data.m_rareData->m_value)
@@ -417,7 +441,7 @@
     , m_isForPage(o.m_isForPage)
     , m_tagIsForNamespaceRule(o.m_tagIsForNamespaceRule)
 {
-    if (o.m_match == Tag) {
+    if (o.match() == Tag) {
         m_data.m_tagQName = o.m_data.m_tagQName;
         m_data.m_tagQName->ref();
     } else if (o.m_hasRareData) {
@@ -431,7 +455,7 @@
 
 inline CSSSelector::~CSSSelector()
 {
-    if (m_match == Tag)
+    if (match() == Tag)
         m_data.m_tagQName->deref();
     else if (m_hasRareData)
         m_data.m_rareData->deref();
@@ -441,13 +465,13 @@
 
 inline const QualifiedName& CSSSelector::tagQName() const
 {
-    ASSERT(m_match == Tag);
+    ASSERT(match() == Tag);
     return *reinterpret_cast<const QualifiedName*>(&m_data.m_tagQName);
 }
 
 inline const AtomicString& CSSSelector::value() const
 {
-    ASSERT(m_match != Tag);
+    ASSERT(match() != Tag);
     // AtomicString is really just an AtomicStringImpl* so the cast below is safe.
     // FIXME: Perhaps call sites could be changed to accept AtomicStringImpl?
     return *reinterpret_cast<const AtomicString*>(m_hasRareData ? &m_data.m_rareData->m_value : &m_data.m_value);

Modified: trunk/Source/WebCore/css/CSSSelectorList.cpp (173568 => 173569)


--- trunk/Source/WebCore/css/CSSSelectorList.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/CSSSelectorList.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -166,7 +166,7 @@
 public:
     bool operator()(const CSSSelector* selector)
     {
-        if (selector->m_match == CSSSelector::Tag && selector->tagQName().prefix() != nullAtom && selector->tagQName().prefix() != starAtom)
+        if (selector->match() == CSSSelector::Tag && selector->tagQName().prefix() != nullAtom && selector->tagQName().prefix() != starAtom)
             return true;
         if (selector->isAttributeSelector() && selector->attribute().prefix() != nullAtom && selector->attribute().prefix() != starAtom)
             return true;

Modified: trunk/Source/WebCore/css/PageRuleCollector.cpp (173568 => 173569)


--- trunk/Source/WebCore/css/PageRuleCollector.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/PageRuleCollector.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -92,11 +92,11 @@
 static bool checkPageSelectorComponents(const CSSSelector* selector, bool isLeftPage, bool isFirstPage, const String& pageName)
 {
     for (const CSSSelector* component = selector; component; component = component->tagHistory()) {
-        if (component->m_match == CSSSelector::Tag) {
+        if (component->match() == CSSSelector::Tag) {
             const AtomicString& localName = component->tagQName().localName();
             if (localName != starAtom && localName != pageName)
                 return false;
-        } else if (component->m_match == CSSSelector::PagePseudoClass) {
+        } else if (component->match() == CSSSelector::PagePseudoClass) {
             CSSSelector::PagePseudoClassType pseudoType = component->pagePseudoClassType();
             if ((pseudoType == CSSSelector::PagePseudoClassLeft && !isLeftPage)
                 || (pseudoType == CSSSelector::PagePseudoClassRight && isLeftPage)

Modified: trunk/Source/WebCore/css/RuleFeature.cpp (173568 => 173569)


--- trunk/Source/WebCore/css/RuleFeature.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/RuleFeature.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -35,14 +35,14 @@
 
 void RuleFeatureSet::collectFeaturesFromSelector(const CSSSelector* selector)
 {
-    if (selector->m_match == CSSSelector::Id)
+    if (selector->match() == CSSSelector::Id)
         idsInRules.add(selector->value().impl());
-    else if (selector->m_match == CSSSelector::Class)
+    else if (selector->match() == CSSSelector::Class)
         classesInRules.add(selector->value().impl());
     else if (selector->isAttributeSelector()) {
         attributeCanonicalLocalNamesInRules.add(selector->attributeCanonicalLocalName().impl());
         attributeLocalNamesInRules.add(selector->attribute().localName().impl());
-    } else if (selector->m_match == CSSSelector::PseudoElement) {
+    } else if (selector->match() == CSSSelector::PseudoElement) {
         switch (selector->pseudoElementType()) {
         case CSSSelector::PseudoElementFirstLine:
             usesFirstLineRules = true;

Modified: trunk/Source/WebCore/css/RuleSet.cpp (173568 => 173569)


--- trunk/Source/WebCore/css/RuleSet.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/RuleSet.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -58,13 +58,13 @@
     if (selector.tagHistory())
         return false;
 
-    if (selector.m_match == CSSSelector::Tag) {
+    if (selector.match() == CSSSelector::Tag) {
         const AtomicString& selectorNamespace = selector.tagQName().namespaceURI();
         return selectorNamespace == starAtom || selectorNamespace == xhtmlNamespaceURI;
     }
     if (SelectorChecker::isCommonPseudoClassSelector(&selector))
         return true;
-    return selector.m_match == CSSSelector::Id || selector.m_match == CSSSelector::Class;
+    return selector.match() == CSSSelector::Id || selector.match() == CSSSelector::Class;
 }
 
 static bool selectorCanMatchPseudoElement(const CSSSelector& rootSelector)
@@ -135,7 +135,7 @@
         return PropertyWhitelistRegion;
 #if ENABLE(VIDEO_TRACK)
     for (const CSSSelector* component = selector; component; component = component->tagHistory()) {
-        if (component->m_match == CSSSelector::PseudoElement && (component->pseudoElementType() == CSSSelector::PseudoElementCue || component->value() == TextTrackCue::cueShadowPseudoId()))
+        if (component->match() == CSSSelector::PseudoElement && (component->pseudoElementType() == CSSSelector::PseudoElementCue || component->value() == TextTrackCue::cueShadowPseudoId()))
             return PropertyWhitelistCue;
     }
 #else
@@ -214,13 +214,13 @@
     const CSSSelector* focusSelector = nullptr;
     const CSSSelector* selector = ruleData.selector();
     do {
-        if (selector->m_match == CSSSelector::Id) {
+        if (selector->match() == CSSSelector::Id) {
             addToRuleSet(selector->value().impl(), m_idRules, ruleData);
             return;
         }
 
 #if ENABLE(VIDEO_TRACK)
-        if (selector->m_match == CSSSelector::PseudoElement && selector->pseudoElementType() == CSSSelector::PseudoElementCue) {
+        if (selector->match() == CSSSelector::PseudoElement && selector->pseudoElementType() == CSSSelector::PseudoElementCue) {
             m_cuePseudoRules.append(ruleData);
             return;
         }
@@ -231,7 +231,7 @@
             return;
         }
 
-        if (selector->m_match == CSSSelector::Class) {
+        if (selector->match() == CSSSelector::Class) {
             AtomicStringImpl* className = selector->value().impl();
             if (!classSelector) {
                 classSelector = selector;
@@ -245,7 +245,7 @@
             }
         }
 
-        if (selector->m_match == CSSSelector::Tag && selector->tagQName().localName() != starAtom)
+        if (selector->match() == CSSSelector::Tag && selector->tagQName().localName() != starAtom)
             tagSelector = selector;
 
         if (SelectorChecker::isCommonPseudoClassSelector(selector)) {

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (173568 => 173569)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -224,7 +224,7 @@
     if (!checkOne(context))
         return SelectorFailsLocally;
 
-    if (context.selector->m_match == CSSSelector::PseudoElement) {
+    if (context.selector->match() == CSSSelector::PseudoElement) {
         // In Selectors Level 4, a pseudo element inside a functional pseudo class is undefined (issue 7).
         // Make it as matching failure until the spec clarifies this case.
         if (context.inFunctionalPseudoClass)
@@ -337,7 +337,7 @@
         nextContext.hasSelectionPseudo = dynamicPseudo == SELECTION;
         if ((context.elementStyle || context.resolvingMode == Mode::CollectingRules) && dynamicPseudo != NOPSEUDO
             && !nextContext.hasSelectionPseudo
-            && !(nextContext.hasScrollbarPseudo && nextContext.selector->m_match == CSSSelector::PseudoClass))
+            && !(nextContext.hasScrollbarPseudo && nextContext.selector->match() == CSSSelector::PseudoClass))
             return SelectorFailsCompletely;
         return matchRecursively(nextContext, dynamicPseudo);
 
@@ -427,7 +427,7 @@
         if (!attribute.matches(selectorAttr.prefix(), element->isHTMLElement() ? selector->attributeCanonicalLocalName() : selectorAttr.localName(), selectorAttr.namespaceURI()))
             continue;
 
-        if (attributeValueMatches(attribute, static_cast<CSSSelector::Match>(selector->m_match), selector->value(), caseSensitive))
+        if (attributeValueMatches(attribute, selector->match(), selector->value(), caseSensitive))
             return true;
     }
 
@@ -451,7 +451,7 @@
         return true;
 
     for (const CSSSelector* selector = context.firstSelectorOfTheFragment; selector; selector = selector->tagHistory()) {
-        switch (selector->m_match) {
+        switch (selector->match()) {
         case CSSSelector::Tag:
             if (selector->tagQName() != anyQName())
                 return true;
@@ -496,13 +496,13 @@
     ASSERT(element);
     ASSERT(selector);
 
-    if (selector->m_match == CSSSelector::Tag)
+    if (selector->match() == CSSSelector::Tag)
         return SelectorChecker::tagMatches(element, selector->tagQName());
 
-    if (selector->m_match == CSSSelector::Class)
+    if (selector->match() == CSSSelector::Class)
         return element->hasClass() && element->classNames().contains(selector->value());
 
-    if (selector->m_match == CSSSelector::Id)
+    if (selector->match() == CSSSelector::Id)
         return element->hasID() && element->idForStyleResolution() == selector->value();
 
     if (selector->isAttributeSelector()) {
@@ -516,7 +516,7 @@
             return false;
     }
 
-    if (selector->m_match == CSSSelector::PseudoClass) {
+    if (selector->match() == CSSSelector::PseudoClass) {
         // Handle :not up front.
         if (selector->pseudoClassType() == CSSSelector::PseudoClassNot) {
             const CSSSelectorList* selectorList = selector->selectorList();
@@ -529,7 +529,7 @@
             subContext.inFunctionalPseudoClass = true;
             subContext.firstSelectorOfTheFragment = selectorList->first();
             for (subContext.selector = selectorList->first(); subContext.selector; subContext.selector = subContext.selector->tagHistory()) {
-                if (subContext.selector->m_match == CSSSelector::PseudoClass) {
+                if (subContext.selector->match() == CSSSelector::PseudoClass) {
                     // :not cannot nest. I don't really know why this is a
                     // restriction in CSS3, but it is, so let's honor it.
                     // the parser enforces that this never occurs
@@ -868,7 +868,7 @@
         return false;
     }
 #if ENABLE(VIDEO_TRACK)
-    else if (selector->m_match == CSSSelector::PseudoElement && selector->pseudoElementType() == CSSSelector::PseudoElementCue) {
+    if (selector->match() == CSSSelector::PseudoElement && selector->pseudoElementType() == CSSSelector::PseudoElementCue) {
         CheckingContextWithStatus subContext(context);
 
         PseudoId ignoreDynamicPseudo = NOPSEUDO;
@@ -888,7 +888,7 @@
 
 bool SelectorChecker::checkScrollbarPseudoClass(const CheckingContextWithStatus& context, const CSSSelector* selector) const
 {
-    ASSERT(selector->m_match == CSSSelector::PseudoClass);
+    ASSERT(selector->match() == CSSSelector::PseudoClass);
 
     switch (selector->pseudoClassType()) {
     case CSSSelector::PseudoClassWindowInactive:
@@ -933,7 +933,7 @@
     // Statically 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 (; selector; selector = selector->tagHistory()) {
-        if (selector->m_match == CSSSelector::PseudoClass) {
+        if (selector->match() == CSSSelector::PseudoClass) {
             switch (selector->pseudoClassType()) {
             case CSSSelector::PseudoClassNot:
                 {
@@ -943,7 +943,7 @@
                         break;
 
                     for (const CSSSelector* subSelector = selectorList->first(); subSelector; subSelector = subSelector->tagHistory()) {
-                        if (subSelector->m_match == CSSSelector::PseudoClass) {
+                        if (subSelector->match() == CSSSelector::PseudoClass) {
                             CSSSelector::PseudoClassType subType = subSelector->pseudoClassType();
                             if (subType == CSSSelector::PseudoClassVisited)
                                 linkMatchType &= ~SelectorChecker::MatchVisited;

Modified: trunk/Source/WebCore/css/SelectorChecker.h (173568 => 173569)


--- trunk/Source/WebCore/css/SelectorChecker.h	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/SelectorChecker.h	2014-09-12 19:24:12 UTC (rev 173569)
@@ -94,7 +94,7 @@
 
 inline bool SelectorChecker::isCommonPseudoClassSelector(const CSSSelector* selector)
 {
-    if (selector->m_match != CSSSelector::PseudoClass)
+    if (selector->match() != CSSSelector::PseudoClass)
         return false;
     CSSSelector::PseudoClassType pseudoType = selector->pseudoClassType();
     return pseudoType == CSSSelector::PseudoClassLink

Modified: trunk/Source/WebCore/css/SelectorFilter.cpp (173568 => 173569)


--- trunk/Source/WebCore/css/SelectorFilter.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/css/SelectorFilter.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -112,7 +112,7 @@
 
 static inline void collectDescendantSelectorIdentifierHashes(const CSSSelector* selector, unsigned*& hash)
 {
-    switch (selector->m_match) {
+    switch (selector->match()) {
     case CSSSelector::Id:
         if (!selector->value().isEmpty())
             (*hash++) = selector->value().impl()->existingHash() * IdAttributeSalt;

Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (173568 => 173569)


--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -705,7 +705,7 @@
             return FunctionType::CannotMatchAnything;
         }
 
-        switch (selector->m_match) {
+        switch (selector->match()) {
         case CSSSelector::Tag:
             ASSERT(!fragment.tagName);
             fragment.tagName = &(selector->tagQName());
@@ -2177,7 +2177,7 @@
 
     successCases.link(&m_assembler);
 
-    if (attributeSelector.m_match != CSSSelector::Set) {
+    if (attributeSelector.match() != CSSSelector::Set) {
         // We make the assumption that name matching fails in most cases and we keep value matching outside
         // of the loop. We re-enter the loop if needed.
         // FIXME: exact case sensitive value matching is so simple that it should be done in the loop.
@@ -2269,7 +2269,7 @@
     ASSERT(!expectedValue.isNull());
     bool defaultToCaseSensitiveValueMatch = attributeInfo.canDefaultToCaseSensitiveValueMatch();
 
-    switch (attributeSelector.m_match) {
+    switch (attributeSelector.match()) {
     case CSSSelector::Begin:
         generateElementAttributeFunctionCallValueMatching(failureCases, currentAttributeAddress, expectedValue, defaultToCaseSensitiveValueMatch, attributeValueBeginsWith<CaseSensitive>, attributeValueBeginsWith<CaseInsensitive>);
         break;

Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (173568 => 173569)


--- trunk/Source/WebCore/dom/SelectorQuery.cpp	2014-09-12 19:08:45 UTC (rev 173568)
+++ trunk/Source/WebCore/dom/SelectorQuery.cpp	2014-09-12 19:24:12 UTC (rev 173569)
@@ -37,12 +37,12 @@
 #if !ASSERT_DISABLED
 static bool isSingleTagNameSelector(const CSSSelector& selector)
 {
-    return selector.isLastInTagHistory() && selector.m_match == CSSSelector::Tag;
+    return selector.isLastInTagHistory() && selector.match() == CSSSelector::Tag;
 }
 
 static bool isSingleClassNameSelector(const CSSSelector& selector)
 {
-    return selector.isLastInTagHistory() && selector.m_match == CSSSelector::Class;
+    return selector.isLastInTagHistory() && selector.match() == CSSSelector::Class;
 }
 #endif
 
@@ -56,7 +56,7 @@
 {
     bool inRightmost = true;
     for (const CSSSelector* selector = &firstSelector; selector; selector = selector->tagHistory()) {
-        if (selector->m_match == CSSSelector::Id) {
+        if (selector->match() == CSSSelector::Id) {
             if (inRightmost)
                 return IdMatchingType::Rightmost;
             return IdMatchingType::Filter;
@@ -80,7 +80,7 @@
     if (selectorCount == 1) {
         const CSSSelector& selector = *m_selectors.first().selector;
         if (selector.isLastInTagHistory()) {
-            switch (selector.m_match) {
+            switch (selector.match()) {
             case CSSSelector::Tag:
                 m_matchType = TagNameMatch;
                 break;
@@ -168,7 +168,7 @@
         return nullptr;
 
     for (const CSSSelector* selector = &firstSelector; selector; selector = selector->tagHistory()) {
-        if (selector->m_match == CSSSelector::Id)
+        if (selector->match() == CSSSelector::Id)
             return selector;
         if (selector->relation() != CSSSelector::SubSelector)
             break;
@@ -224,7 +224,7 @@
     // Thus we can skip the rightmost match.
     const CSSSelector* selector = &firstSelector;
     do {
-        ASSERT(selector->m_match != CSSSelector::Id);
+        ASSERT(selector->match() != CSSSelector::Id);
         if (selector->relation() != CSSSelector::SubSelector)
             break;
         selector = selector->tagHistory();
@@ -232,7 +232,7 @@
 
     bool inAdjacentChain = false;
     for (; selector; selector = selector->tagHistory()) {
-        if (selector->m_match == CSSSelector::Id) {
+        if (selector->match() == CSSSelector::Id) {
             const AtomicString& idToMatch = selector->value();
             if (ContainerNode* searchRoot = rootNode.treeScope().getElementById(idToMatch)) {
                 if (LIKELY(!rootNode.treeScope().containsMultipleElementsWithId(idToMatch))) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to