Commit b487e332 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76053 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 17955547
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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment