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

Unified Diff: Source/core/dom/TreeScope.cpp

Issue 642973003: Introduce typed Node/Element iterators for range-based for loops of C++11. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename `from` to `fromNext`. Make some parameters const references. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/TreeScope.cpp
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index deab41141b9feda7538f2647e8e6ccb68087532e..b2c6acb9fe994f1df982faf858f2fd9a6dca1c13 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -524,10 +524,10 @@ Element* TreeScope::getElementByAccessKey(const String& key) const
return 0;
Element* result = 0;
Node& root = rootNode();
- for (Element* element = ElementTraversal::firstWithin(root); element; element = ElementTraversal::next(*element, &root)) {
- if (equalIgnoringCase(element->fastGetAttribute(accesskeyAttr), key))
- result = element;
- for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) {
+ for (Element& element : ElementTraversal::descendantsOf(root)) {
+ if (equalIgnoringCase(element.fastGetAttribute(accesskeyAttr), key))
+ result = &element;
+ for (ShadowRoot* shadowRoot = element.youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) {
if (Element* shadowResult = shadowRoot->getElementByAccessKey(key))
result = shadowResult;
}

Powered by Google App Engine
This is Rietveld 408576698