Title: [150099] trunk/Source/WebCore
- Revision
- 150099
- Author
- rn...@webkit.org
- Date
- 2013-05-14 20:17:43 -0700 (Tue, 14 May 2013)
Log Message
Use ElementTraversal in SelectorDataList::execute
https://bugs.webkit.org/show_bug.cgi?id=116131
Reviewed by Darin Adler.
Use ElementTraversal::firstWithin and ElementTraversal::next to simplify the code.
* dom/SelectorQuery.cpp:
(WebCore::SelectorDataList::execute):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (150098 => 150099)
--- trunk/Source/WebCore/ChangeLog 2013-05-15 02:18:47 UTC (rev 150098)
+++ trunk/Source/WebCore/ChangeLog 2013-05-15 03:17:43 UTC (rev 150099)
@@ -1,3 +1,15 @@
+2013-05-14 Ryosuke Niwa <rn...@webkit.org>
+
+ Use ElementTraversal in SelectorDataList::execute
+ https://bugs.webkit.org/show_bug.cgi?id=116131
+
+ Reviewed by Darin Adler.
+
+ Use ElementTraversal::firstWithin and ElementTraversal::next to simplify the code.
+
+ * dom/SelectorQuery.cpp:
+ (WebCore::SelectorDataList::execute):
+
2013-05-14 Tim Horton <timothy_hor...@apple.com>
[wk2] Not updating tiled backing coverage when main frame scrollability changes
Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (150098 => 150099)
--- trunk/Source/WebCore/dom/SelectorQuery.cpp 2013-05-15 02:18:47 UTC (rev 150098)
+++ trunk/Source/WebCore/dom/SelectorQuery.cpp 2013-05-15 03:17:43 UTC (rev 150099)
@@ -29,6 +29,7 @@
#include "CSSParser.h"
#include "CSSSelectorList.h"
#include "Document.h"
+#include "NodeTraversal.h"
#include "SelectorChecker.h"
#include "SelectorCheckerFastPath.h"
#include "StaticNodeList.h"
@@ -135,30 +136,15 @@
}
unsigned selectorCount = m_selectors.size();
-
- Node* n = rootNode->firstChild();
- while (n) {
- if (n->isElementNode()) {
- Element* element = toElement(n);
- for (unsigned i = 0; i < selectorCount; ++i) {
- if (selectorMatches(m_selectors[i], element, rootNode)) {
- matchedElements.append(element);
- if (firstMatchOnly)
- return;
- break;
- }
+ for (Element* element = ElementTraversal::firstWithin(rootNode); element; element = ElementTraversal::next(element, rootNode)) {
+ for (unsigned i = 0; i < selectorCount; ++i) {
+ if (selectorMatches(m_selectors[i], element, rootNode)) {
+ matchedElements.append(element);
+ if (firstMatchOnly)
+ return;
+ break;
}
- if (element->firstChild()) {
- n = element->firstChild();
- continue;
- }
}
- while (!n->nextSibling()) {
- n = n->parentNode();
- if (n == rootNode)
- return;
- }
- n = n->nextSibling();
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes