Changeset 143150 in webkit
- Timestamp:
- Feb 17, 2013 10:37:10 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143148 r143150 1 2013-02-17 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Stop passing around SelectorChecker in ContentSelectorQuery. 4 https://bugs.webkit.org/show_bug.cgi?id=110041 5 6 Now that SelectorChecker has no interesting state, we can simplify ContentSelectorQuery and get rid of a class. 7 8 Reviewed by Andreas Kling. 9 10 No functional changes, covered by existing tests. 11 12 * html/shadow/ContentSelectorQuery.cpp: 13 (WebCore::ContentSelectorDataList::checkContentSelector): Zapped ContentSelectorChecker and moved its only remaining method here. 14 (WebCore::ContentSelectorDataList::matches): Removed SelectorChecker argument. 15 (WebCore::ContentSelectorQuery::ContentSelectorQuery): Removed an unnecessary member. 16 (WebCore::ContentSelectorQuery::matches): Removed unnecessary argument. 17 * html/shadow/ContentSelectorQuery.h: 18 (WebCore): Cleaned up the file. 19 (ContentSelectorDataList): Updated decls. 20 (ContentSelectorQuery): Ditto. 21 1 22 2013-02-17 Mike West <mkwst@chromium.org> 2 23 -
trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp
r142717 r143150 36 36 namespace WebCore { 37 37 38 ContentSelectorChecker::ContentSelectorChecker(Document* document) 39 : m_selectorChecker(document, SelectorChecker::CollectingRules) 38 bool ContentSelectorDataList::checkContentSelector(const CSSSelector* selector, const Vector<RefPtr<Node> >& siblings, int nth) 40 39 { 41 } 42 43 bool ContentSelectorChecker::checkContentSelector(const CSSSelector* selector, const Vector<RefPtr<Node> >& siblings, int nth) const 44 { 45 SelectorChecker::SelectorCheckingContext context(selector, toElement(siblings[nth].get()), SelectorChecker::VisitedMatchEnabled); 40 Element* element = toElement(siblings[nth].get()); 41 SelectorChecker selectorChecker(element->document(), SelectorChecker::CollectingRules); 42 SelectorChecker::SelectorCheckingContext context(selector, element, SelectorChecker::VisitedMatchEnabled); 46 43 ShadowDOMSiblingTraversalStrategy strategy(siblings, nth); 47 44 PseudoId ignoreDynamicPseudo = NOPSEUDO; 48 return m_selectorChecker.match(context, ignoreDynamicPseudo, strategy) == SelectorChecker::SelectorMatches;45 return selectorChecker.match(context, ignoreDynamicPseudo, strategy) == SelectorChecker::SelectorMatches; 49 46 } 50 47 … … 55 52 } 56 53 57 bool ContentSelectorDataList::matches(const ContentSelectorChecker& selectorChecker, constVector<RefPtr<Node> >& siblings, int nth) const54 bool ContentSelectorDataList::matches(const Vector<RefPtr<Node> >& siblings, int nth) const 58 55 { 59 56 unsigned selectorCount = m_selectors.size(); 60 57 for (unsigned i = 0; i < selectorCount; ++i) { 61 if ( selectorChecker.checkContentSelector(m_selectors[i], siblings, nth))58 if (checkContentSelector(m_selectors[i], siblings, nth)) 62 59 return true; 63 60 } … … 67 64 ContentSelectorQuery::ContentSelectorQuery(InsertionPoint* insertionPoint) 68 65 : m_insertionPoint(insertionPoint) 69 , m_selectorChecker(insertionPoint->document())70 66 { 71 67 m_selectors.initialize(insertionPoint->selectorList()); … … 83 79 return false; 84 80 case InsertionPoint::HasToMatchSelector: 85 return node->isElementNode() && m_selectors.matches( m_selectorChecker,siblings, nth);81 return node->isElementNode() && m_selectors.matches(siblings, nth); 86 82 default: 87 83 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/html/shadow/ContentSelectorQuery.h
r140530 r143150 44 44 class InsertionPoint; 45 45 46 class ContentSelectorChecker {47 public:48 ContentSelectorChecker(Document*);49 50 bool checkContentSelector(const CSSSelector*, const Vector<RefPtr<Node> >& siblings, int nthNode) const;51 private:52 SelectorChecker m_selectorChecker;53 };54 55 46 class ContentSelectorDataList { 56 47 public: 57 48 void initialize(const CSSSelectorList&); 58 bool matches(const ContentSelectorChecker&, constVector<RefPtr<Node> >& siblings, int nthNode) const;49 bool matches(const Vector<RefPtr<Node> >& siblings, int nthNode) const; 59 50 60 51 private: 52 static bool checkContentSelector(const CSSSelector*, const Vector<RefPtr<Node> >& siblings, int nthNode); 53 61 54 Vector<const CSSSelector*> m_selectors; 62 55 }; … … 68 61 69 62 bool matches(const Vector<RefPtr<Node> >& siblings, int nthNode) const; 63 70 64 private: 71 72 65 InsertionPoint* m_insertionPoint; 73 66 ContentSelectorDataList m_selectors; 74 ContentSelectorChecker m_selectorChecker;75 67 }; 76 68
Note: See TracChangeset
for help on using the changeset viewer.