Title: [143150] trunk/Source/WebCore
Revision
143150
Author
[email protected]
Date
2013-02-17 22:37:10 -0800 (Sun, 17 Feb 2013)

Log Message

Stop passing around SelectorChecker in ContentSelectorQuery.
https://bugs.webkit.org/show_bug.cgi?id=110041

Now that SelectorChecker has no interesting state, we can simplify ContentSelectorQuery and get rid of a class.

Reviewed by Andreas Kling.

No functional changes, covered by existing tests.

* html/shadow/ContentSelectorQuery.cpp:
(WebCore::ContentSelectorDataList::checkContentSelector): Zapped ContentSelectorChecker and moved its only remaining method here.
(WebCore::ContentSelectorDataList::matches): Removed SelectorChecker argument.
(WebCore::ContentSelectorQuery::ContentSelectorQuery): Removed an unnecessary member.
(WebCore::ContentSelectorQuery::matches): Removed unnecessary argument.
* html/shadow/ContentSelectorQuery.h:
(WebCore): Cleaned up the file.
(ContentSelectorDataList): Updated decls.
(ContentSelectorQuery): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143149 => 143150)


--- trunk/Source/WebCore/ChangeLog	2013-02-18 06:33:45 UTC (rev 143149)
+++ trunk/Source/WebCore/ChangeLog	2013-02-18 06:37:10 UTC (rev 143150)
@@ -1,3 +1,24 @@
+2013-02-17  Dimitri Glazkov  <[email protected]>
+
+        Stop passing around SelectorChecker in ContentSelectorQuery.
+        https://bugs.webkit.org/show_bug.cgi?id=110041
+
+        Now that SelectorChecker has no interesting state, we can simplify ContentSelectorQuery and get rid of a class.
+
+        Reviewed by Andreas Kling.
+
+        No functional changes, covered by existing tests.
+
+        * html/shadow/ContentSelectorQuery.cpp:
+        (WebCore::ContentSelectorDataList::checkContentSelector): Zapped ContentSelectorChecker and moved its only remaining method here.
+        (WebCore::ContentSelectorDataList::matches): Removed SelectorChecker argument.
+        (WebCore::ContentSelectorQuery::ContentSelectorQuery): Removed an unnecessary member.
+        (WebCore::ContentSelectorQuery::matches): Removed unnecessary argument.
+        * html/shadow/ContentSelectorQuery.h:
+        (WebCore): Cleaned up the file.
+        (ContentSelectorDataList): Updated decls.
+        (ContentSelectorQuery): Ditto.
+
 2013-02-17  Mike West  <[email protected]>
 
         WheelEvent should not target text nodes.

Modified: trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp (143149 => 143150)


--- trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp	2013-02-18 06:33:45 UTC (rev 143149)
+++ trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp	2013-02-18 06:37:10 UTC (rev 143150)
@@ -35,17 +35,14 @@
 
 namespace WebCore {
 
-ContentSelectorChecker::ContentSelectorChecker(Document* document)
-    : m_selectorChecker(document, SelectorChecker::CollectingRules)
+bool ContentSelectorDataList::checkContentSelector(const CSSSelector* selector, const Vector<RefPtr<Node> >& siblings, int nth)
 {
-}
-
-bool ContentSelectorChecker::checkContentSelector(const CSSSelector* selector, const Vector<RefPtr<Node> >& siblings, int nth) const
-{
-    SelectorChecker::SelectorCheckingContext context(selector, toElement(siblings[nth].get()), SelectorChecker::VisitedMatchEnabled);
+    Element* element = toElement(siblings[nth].get());
+    SelectorChecker selectorChecker(element->document(), SelectorChecker::CollectingRules);
+    SelectorChecker::SelectorCheckingContext context(selector, element, SelectorChecker::VisitedMatchEnabled);
     ShadowDOMSiblingTraversalStrategy strategy(siblings, nth);
     PseudoId ignoreDynamicPseudo = NOPSEUDO;
-    return m_selectorChecker.match(context, ignoreDynamicPseudo, strategy) == SelectorChecker::SelectorMatches;
+    return selectorChecker.match(context, ignoreDynamicPseudo, strategy) == SelectorChecker::SelectorMatches;
 }
 
 void ContentSelectorDataList::initialize(const CSSSelectorList& selectors)
@@ -54,11 +51,11 @@
         m_selectors.append(selector);
 }
 
-bool ContentSelectorDataList::matches(const ContentSelectorChecker& selectorChecker, const Vector<RefPtr<Node> >& siblings, int nth) const
+bool ContentSelectorDataList::matches(const Vector<RefPtr<Node> >& siblings, int nth) const
 {
     unsigned selectorCount = m_selectors.size();
     for (unsigned i = 0; i < selectorCount; ++i) {
-        if (selectorChecker.checkContentSelector(m_selectors[i], siblings, nth))
+        if (checkContentSelector(m_selectors[i], siblings, nth))
             return true;
     }
     return false;
@@ -66,7 +63,6 @@
 
 ContentSelectorQuery::ContentSelectorQuery(InsertionPoint* insertionPoint)
     : m_insertionPoint(insertionPoint)
-    , m_selectorChecker(insertionPoint->document())
 {
     m_selectors.initialize(insertionPoint->selectorList());
 }
@@ -82,7 +78,7 @@
     case InsertionPoint::NeverMatches:
         return false;
     case InsertionPoint::HasToMatchSelector:
-        return node->isElementNode() && m_selectors.matches(m_selectorChecker, siblings, nth);
+        return node->isElementNode() && m_selectors.matches(siblings, nth);
     default:
         ASSERT_NOT_REACHED();
         return false;

Modified: trunk/Source/WebCore/html/shadow/ContentSelectorQuery.h (143149 => 143150)


--- trunk/Source/WebCore/html/shadow/ContentSelectorQuery.h	2013-02-18 06:33:45 UTC (rev 143149)
+++ trunk/Source/WebCore/html/shadow/ContentSelectorQuery.h	2013-02-18 06:37:10 UTC (rev 143150)
@@ -43,21 +43,14 @@
 class Node;
 class InsertionPoint;
 
-class ContentSelectorChecker {
-public:
-    ContentSelectorChecker(Document*);
-
-    bool checkContentSelector(const CSSSelector*, const Vector<RefPtr<Node> >& siblings, int nthNode) const;
-private:
-    SelectorChecker m_selectorChecker;
-};
-
 class ContentSelectorDataList {
 public:
     void initialize(const CSSSelectorList&);
-    bool matches(const ContentSelectorChecker&, const Vector<RefPtr<Node> >& siblings, int nthNode) const;
+    bool matches(const Vector<RefPtr<Node> >& siblings, int nthNode) const;
 
 private:
+    static bool checkContentSelector(const CSSSelector*, const Vector<RefPtr<Node> >& siblings, int nthNode);
+
     Vector<const CSSSelector*> m_selectors;
 };
 
@@ -67,11 +60,10 @@
     explicit ContentSelectorQuery(InsertionPoint*);
 
     bool matches(const Vector<RefPtr<Node> >& siblings, int nthNode) const;
-private:
 
+private:
     InsertionPoint* m_insertionPoint;
     ContentSelectorDataList m_selectors;
-    ContentSelectorChecker m_selectorChecker;
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to