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

Side by Side Diff: Source/core/html/shadow/HTMLContentElement.cpp

Issue 149513011: Pass around CSSSelector by reference instead of pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 bool HTMLContentElement::validateSelect() const 84 bool HTMLContentElement::validateSelect() const
85 { 85 {
86 ASSERT(!m_shouldParseSelect); 86 ASSERT(!m_shouldParseSelect);
87 87
88 if (m_select.isNull() || m_select.isEmpty()) 88 if (m_select.isNull() || m_select.isEmpty())
89 return true; 89 return true;
90 90
91 if (!m_selectorList.isValid()) 91 if (!m_selectorList.isValid())
92 return false; 92 return false;
93 93
94 for (const CSSSelector* selector = m_selectorList.first(); selector; selecto r = m_selectorList.next(selector)) { 94 for (const CSSSelector* selector = m_selectorList.first(); selector; selecto r = m_selectorList.next(*selector)) {
95 if (!selector->isCompound()) 95 if (!selector->isCompound())
96 return false; 96 return false;
97 } 97 }
98 98
99 return true; 99 return true;
100 } 100 }
101 101
102 static inline bool checkOneSelector(const CSSSelector* selector, const Vector<No de*, 32>& siblings, int nth) 102 static inline bool checkOneSelector(const CSSSelector& selector, const Vector<No de*, 32>& siblings, int nth)
103 { 103 {
104 Element* element = toElement(siblings[nth]); 104 Element* element = toElement(siblings[nth]);
105 SelectorChecker selectorChecker(element->document(), SelectorChecker::Collec tingCSSRules); 105 SelectorChecker selectorChecker(element->document(), SelectorChecker::Collec tingCSSRules);
106 SelectorChecker::SelectorCheckingContext context(selector, element, Selector Checker::VisitedMatchEnabled); 106 SelectorChecker::SelectorCheckingContext context(selector, element, Selector Checker::VisitedMatchEnabled);
107 ShadowDOMSiblingTraversalStrategy strategy(siblings, nth); 107 ShadowDOMSiblingTraversalStrategy strategy(siblings, nth);
108 return selectorChecker.match(context, strategy) == SelectorChecker::Selector Matches; 108 return selectorChecker.match(context, strategy) == SelectorChecker::Selector Matches;
109 } 109 }
110 110
111 bool HTMLContentElement::matchSelector(const Vector<Node*, 32>& siblings, int nt h) const 111 bool HTMLContentElement::matchSelector(const Vector<Node*, 32>& siblings, int nt h) const
112 { 112 {
113 for (const CSSSelector* selector = selectorList().first(); selector; selecto r = CSSSelectorList::next(selector)) { 113 for (const CSSSelector* selector = selectorList().first(); selector; selecto r = CSSSelectorList::next(*selector)) {
114 if (checkOneSelector(selector, siblings, nth)) 114 if (checkOneSelector(*selector, siblings, nth))
115 return true; 115 return true;
116 } 116 }
117 return false; 117 return false;
118 } 118 }
119 119
120 } 120 }
OLDNEW
« no previous file with comments | « Source/core/dom/shadow/SelectRuleFeatureSet.cpp ('k') | Source/core/inspector/InspectorCSSAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698