Changeset 150099 in webkit
- Timestamp:
- May 14, 2013 8:17:43 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150093 r150099 1 2013-05-14 Ryosuke Niwa <rniwa@webkit.org> 2 3 Use ElementTraversal in SelectorDataList::execute 4 https://bugs.webkit.org/show_bug.cgi?id=116131 5 6 Reviewed by Darin Adler. 7 8 Use ElementTraversal::firstWithin and ElementTraversal::next to simplify the code. 9 10 * dom/SelectorQuery.cpp: 11 (WebCore::SelectorDataList::execute): 12 1 13 2013-05-14 Tim Horton <timothy_horton@apple.com> 2 14 -
trunk/Source/WebCore/dom/SelectorQuery.cpp
r149498 r150099 30 30 #include "CSSSelectorList.h" 31 31 #include "Document.h" 32 #include "NodeTraversal.h" 32 33 #include "SelectorChecker.h" 33 34 #include "SelectorCheckerFastPath.h" … … 136 137 137 138 unsigned selectorCount = m_selectors.size(); 138 139 Node* n = rootNode->firstChild(); 140 while (n) { 141 if (n->isElementNode()) { 142 Element* element = toElement(n); 143 for (unsigned i = 0; i < selectorCount; ++i) { 144 if (selectorMatches(m_selectors[i], element, rootNode)) { 145 matchedElements.append(element); 146 if (firstMatchOnly) 147 return; 148 break; 149 } 150 } 151 if (element->firstChild()) { 152 n = element->firstChild(); 153 continue; 139 for (Element* element = ElementTraversal::firstWithin(rootNode); element; element = ElementTraversal::next(element, rootNode)) { 140 for (unsigned i = 0; i < selectorCount; ++i) { 141 if (selectorMatches(m_selectors[i], element, rootNode)) { 142 matchedElements.append(element); 143 if (firstMatchOnly) 144 return; 145 break; 154 146 } 155 147 } 156 while (!n->nextSibling()) {157 n = n->parentNode();158 if (n == rootNode)159 return;160 }161 n = n->nextSibling();162 148 } 163 149 }
Note: See TracChangeset
for help on using the changeset viewer.