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

Unified Diff: Source/core/html/HTMLTextFormControlElement.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/html/HTMLTextFormControlElement.cpp
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp
index 4ba5d7d6cf0e194a61eeb5f1591b0226700f4be7..ddadae6c4d23ed3b9e59be24e358d3ea079ed76e 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -293,22 +293,22 @@ static Position positionForIndex(HTMLElement* innerEditor, int index)
}
int remainingCharactersToMoveForward = index;
Node* lastBrOrText = innerEditor;
- for (Node* node = NodeTraversal::next(*innerEditor, innerEditor); node; node = NodeTraversal::next(*node, innerEditor)) {
+ for (Node& node : NodeTraversal::descendantsOf(*innerEditor)) {
ASSERT(remainingCharactersToMoveForward >= 0);
- if (node->hasTagName(brTag)) {
+ if (node.hasTagName(brTag)) {
if (remainingCharactersToMoveForward == 0)
- return positionBeforeNode(node);
+ return positionBeforeNode(&node);
--remainingCharactersToMoveForward;
- lastBrOrText = node;
+ lastBrOrText = &node;
continue;
}
- if (node->isTextNode()) {
- Text& text = toText(*node);
+ if (node.isTextNode()) {
+ Text& text = toText(node);
if (remainingCharactersToMoveForward < static_cast<int>(text.length()))
return Position(&text, remainingCharactersToMoveForward);
remainingCharactersToMoveForward -= text.length();
- lastBrOrText = node;
+ lastBrOrText = &node;
continue;
}

Powered by Google App Engine
This is Rietveld 408576698