Skip to content
Permalink
Browse files
2011-01-18 Benjamin Kalman <kalman@chromium.org>
        Reviewed by Ryosuke Niwa.

        Tweak style in visible_units.cpp and TextIterator.cpp in preparation for another patch
        https://bugs.webkit.org/show_bug.cgi?id=52610

        This is a purely aesthetic change.

        * editing/TextIterator.cpp:
        (WebCore::SimplifiedBackwardsTextIterator::advance):
        * editing/visible_units.cpp:
        (WebCore::previousBoundary):

Canonical link: https://commits.webkit.org/66291@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76053 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Jan 18, 2011
1 parent 9e23746 commit cd8f9c245e31dd1cb92a98192d62b9fe141fe354
Showing 3 changed files with 30 additions and 20 deletions.
@@ -1,3 +1,17 @@
2011-01-18 Benjamin Kalman <kalman@chromium.org>

Reviewed by Ryosuke Niwa.

Tweak style in visible_units.cpp and TextIterator.cpp in preparation for another patch
https://bugs.webkit.org/show_bug.cgi?id=52610

This is a purely aesthetic change.

* editing/TextIterator.cpp:
(WebCore::SimplifiedBackwardsTextIterator::advance):
* editing/visible_units.cpp:
(WebCore::previousBoundary):

2011-01-18 Adam Klein <adamk@chromium.org>

Reviewed by Darin Fisher.
@@ -1128,10 +1128,10 @@ void SimplifiedBackwardsTextIterator::advance()
if (!next) {
// Exit empty containers as we pass over them or containers
// where [container, 0] is where we started iterating.
if (!m_handledNode &&
canHaveChildrenForEditing(m_node) &&
m_node->parentNode() &&
(!m_node->lastChild() || (m_node == m_endNode && m_endOffset == 0))) {
if (!m_handledNode
&& canHaveChildrenForEditing(m_node)
&& m_node->parentNode()
&& (!m_node->lastChild() || (m_node == m_endNode && !m_endOffset))) {
exitNode();
if (m_positionNode) {
m_handledNode = true;
@@ -115,22 +115,18 @@ static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch
ASSERT(!needMoreContext);
}

if (it.atEnd() && next == 0) {
pos = it.range()->startPosition();
} else if (next != 0) {
Node *node = it.range()->startContainer(ec);
if ((node->isTextNode() && static_cast<int>(next) <= node->maxCharacterOffset()) || (node->renderer() && node->renderer()->isBR() && !next))
// The next variable contains a usable index into a text node
pos = Position(node, next);
else {
// Use the character iterator to translate the next value into a DOM position.
BackwardsCharacterIterator charIt(searchRange.get(), TextIteratorEndsAtEditingBoundary);
charIt.advance(string.size() - suffixLength - next);
pos = charIt.range()->endPosition();
}
}

return VisiblePosition(pos, DOWNSTREAM);
if (!next)
return VisiblePosition(it.atEnd() ? it.range()->startPosition() : pos, DOWNSTREAM);

Node* node = it.range()->startContainer(ec);
if ((node->isTextNode() && static_cast<int>(next) <= node->maxCharacterOffset()) || (node->renderer() && node->renderer()->isBR() && !next))
// The next variable contains a usable index into a text node
return VisiblePosition(Position(node, next), DOWNSTREAM);

// Use the character iterator to translate the next value into a DOM position.
BackwardsCharacterIterator charIt(searchRange.get(), TextIteratorEndsAtEditingBoundary);
charIt.advance(string.size() - suffixLength - next);
return VisiblePosition(charIt.range()->endPosition(), DOWNSTREAM);
}

static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunction searchFunction)

0 comments on commit cd8f9c2

Please sign in to comment.