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

Unified Diff: Source/core/editing/TextIterator.cpp

Issue 425223005: Move Node/ContainerNode's traverseToChildAt() to NodeTraversal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
« no previous file with comments | « Source/core/editing/InsertParagraphSeparatorCommand.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/TextIterator.cpp
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index de20c1cc343fe3c6c7266fa80872eb5f29b3258f..974ae2b6fbea5a358ace88d83c4dd688c4ba22fb 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -176,7 +176,7 @@ static Node* nextInPreOrderCrossingShadowBoundaries(Node* rangeEndContainer, int
if (!rangeEndContainer)
return 0;
if (rangeEndOffset >= 0 && !rangeEndContainer->offsetInCharacters()) {
- if (Node* next = rangeEndContainer->traverseToChildAt(rangeEndOffset))
+ if (Node* next = NodeTraversal::childAt(*rangeEndContainer, rangeEndOffset))
return next;
}
for (Node* node = rangeEndContainer; node; node = node->parentOrShadowHostNode()) {
@@ -332,7 +332,7 @@ void TextIterator::initialize(const Position& start, const Position& end)
// Set up the current node for processing.
if (startContainer->offsetInCharacters())
m_node = startContainer;
- else if (Node* child = startContainer->traverseToChildAt(startOffset))
+ else if (Node* child = NodeTraversal::childAt(*startContainer, startOffset))
m_node = child;
else if (!startOffset)
m_node = startContainer;
@@ -1214,7 +1214,7 @@ Node* TextIterator::node() const
if (node->offsetInCharacters())
return node;
- return node->traverseToChildAt(textRange->startOffset());
+ return NodeTraversal::childAt(*node, textRange->startOffset());
}
// --------
@@ -1255,17 +1255,17 @@ SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range* r,
int endOffset = r->endOffset();
if (!startNode->offsetInCharacters() && startOffset >= 0) {
- // traverseToChildAt() will return 0 if the offset is out of range. We rely on this behavior
+ // NodeTraversal::childAt() will return 0 if the offset is out of range. We rely on this behavior
// instead of calling countChildren() to avoid traversing the children twice.
- if (Node* childAtOffset = startNode->traverseToChildAt(startOffset)) {
+ if (Node* childAtOffset = NodeTraversal::childAt(*startNode, startOffset)) {
startNode = childAtOffset;
startOffset = 0;
}
}
if (!endNode->offsetInCharacters() && endOffset > 0) {
- // traverseToChildAt() will return 0 if the offset is out of range. We rely on this behavior
+ // NodeTraversal::childAt() will return 0 if the offset is out of range. We rely on this behavior
// instead of calling countChildren() to avoid traversing the children twice.
- if (Node* childAtOffset = endNode->traverseToChildAt(endOffset - 1)) {
+ if (Node* childAtOffset = NodeTraversal::childAt(*endNode, endOffset - 1)) {
endNode = childAtOffset;
endOffset = lastOffsetInNode(endNode);
}
« no previous file with comments | « Source/core/editing/InsertParagraphSeparatorCommand.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698