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

Unified Diff: Source/core/dom/DocumentOrderedMap.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/DocumentOrderedMap.cpp
diff --git a/Source/core/dom/DocumentOrderedMap.cpp b/Source/core/dom/DocumentOrderedMap.cpp
index 556fe1a8ba1e747266cc71eed22e950a5e04e0de..c0b4039bed16d3360216ac911babb5a9bd6adc40 100644
--- a/Source/core/dom/DocumentOrderedMap.cpp
+++ b/Source/core/dom/DocumentOrderedMap.cpp
@@ -121,11 +121,11 @@ inline Element* DocumentOrderedMap::get(const AtomicString& key, const TreeScope
return entry->element;
// We know there's at least one node that matches; iterate to find the first one.
- for (Element* element = ElementTraversal::firstWithin(scope->rootNode()); element; element = ElementTraversal::next(*element)) {
- if (!keyMatches(key, *element))
+ for (Element& element : ElementTraversal::fromNext(scope->rootNode())) {
+ if (!keyMatches(key, element))
continue;
- entry->element = element;
- return element;
+ entry->element = &element;
+ return &element;
}
ASSERT_NOT_REACHED();
return 0;

Powered by Google App Engine
This is Rietveld 408576698