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

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

Issue 171773008: Rename childNodeCount() / childNode() methods for clarity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Further renaming for consistency Created 6 years, 10 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/ReplaceSelectionCommand.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 a406ad8cc5ad2bfd340e3531adcc16bcab8583fa..72052a5885070fc3a70e4ef2982726ca14ffe87b 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -175,7 +175,7 @@ static Node* nextInPreOrderCrossingShadowBoundaries(Node* rangeEndContainer, int
if (!rangeEndContainer)
return 0;
if (rangeEndOffset >= 0 && !rangeEndContainer->offsetInCharacters()) {
- if (Node* next = rangeEndContainer->childNode(rangeEndOffset))
+ if (Node* next = rangeEndContainer->traverseToChildAt(rangeEndOffset))
return next;
}
for (Node* node = rangeEndContainer; node; node = node->parentOrShadowHostNode()) {
@@ -1143,7 +1143,7 @@ Node* TextIterator::node() const
if (node->offsetInCharacters())
return node;
- return node->childNode(textRange->startOffset());
+ return node->traverseToChildAt(textRange->startOffset());
}
// --------
@@ -1184,17 +1184,17 @@ SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range* r,
int endOffset = r->endOffset();
if (!startNode->offsetInCharacters() && startOffset >= 0) {
- // childNode() will return 0 if the offset is out of range. We rely on this behavior
- // instead of calling childNodeCount() to avoid traversing the children twice.
- if (Node* childAtOffset = startNode->childNode(startOffset)) {
+ // traverseToChildAt() 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)) {
startNode = childAtOffset;
startOffset = 0;
}
}
if (!endNode->offsetInCharacters() && endOffset > 0) {
- // childNode() will return 0 if the offset is out of range. We rely on this behavior
- // instead of calling childNodeCount() to avoid traversing the children twice.
- if (Node* childAtOffset = endNode->childNode(endOffset - 1)) {
+ // traverseToChildAt() 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)) {
endNode = childAtOffset;
endOffset = lastOffsetInNode(endNode);
}
@@ -1257,7 +1257,7 @@ void SimplifiedBackwardsTextIterator::advance()
return;
}
- if (!m_handledChildren && m_node->hasChildNodes()) {
+ if (!m_handledChildren && m_node->hasChildren()) {
m_node = m_node->lastChild();
pushFullyClippedState(m_fullyClippedStack, m_node);
} else {
« no previous file with comments | « Source/core/editing/ReplaceSelectionCommand.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698