Commit 0f480a31 authored by yosin@chromium.org's avatar yosin@chromium.org

Avoid to use abbreviated names in {first,last}EditableVisiblePosition{After,Before}PositionInRoot

This patch renames abbreviated name "p" to "editablePosition" in {first,last}EditableVisiblePosition{After,Before}PositionInRoot for improving readability and ease of maintenance.

This patch is a preparation of introducing |lastEditablePositionBeforePositionInRoot.

BUG=n/a
TEST=n/a; no behavior changes

Review URL: https://codereview.chromium.org/342553008

git-svn-id: svn://svn.chromium.org/blink/trunk@176491 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 24fb0368
......@@ -264,23 +264,23 @@ VisiblePosition firstEditableVisiblePositionAfterPositionInRoot(const Position&
if (comparePositions(position, firstPositionInNode(highestRoot)) == -1 && highestRoot->rendererIsEditable())
return VisiblePosition(firstPositionInNode(highestRoot));
Position p = position;
Position editablePosition = position;
if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.deprecatedNode());
Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(editablePosition.deprecatedNode());
if (!shadowAncestor)
return VisiblePosition();
p = positionAfterNode(shadowAncestor);
editablePosition = positionAfterNode(shadowAncestor);
}
while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot))
p = isAtomicNode(p.deprecatedNode()) ? positionInParentAfterNode(*p.deprecatedNode()) : nextVisuallyDistinctCandidate(p);
while (editablePosition.deprecatedNode() && !isEditablePosition(editablePosition) && editablePosition.deprecatedNode()->isDescendantOf(highestRoot))
editablePosition = isAtomicNode(editablePosition.deprecatedNode()) ? positionInParentAfterNode(*editablePosition.deprecatedNode()) : nextVisuallyDistinctCandidate(editablePosition);
if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecatedNode()->isDescendantOf(highestRoot))
if (editablePosition.deprecatedNode() && editablePosition.deprecatedNode() != highestRoot && !editablePosition.deprecatedNode()->isDescendantOf(highestRoot))
return VisiblePosition();
return VisiblePosition(p);
return VisiblePosition(editablePosition);
}
VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position& position, Node* highestRoot)
......@@ -289,23 +289,23 @@ VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position&
if (comparePositions(position, lastPositionInNode(highestRoot)) == 1)
return VisiblePosition(lastPositionInNode(highestRoot));
Position p = position;
Position editablePosition = position;
if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.deprecatedNode());
Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(editablePosition.deprecatedNode());
if (!shadowAncestor)
return VisiblePosition();
p = firstPositionInOrBeforeNode(shadowAncestor);
editablePosition = firstPositionInOrBeforeNode(shadowAncestor);
}
while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot))
p = isAtomicNode(p.deprecatedNode()) ? positionInParentBeforeNode(*p.deprecatedNode()) : previousVisuallyDistinctCandidate(p);
while (editablePosition.deprecatedNode() && !isEditablePosition(editablePosition) && editablePosition.deprecatedNode()->isDescendantOf(highestRoot))
editablePosition = isAtomicNode(editablePosition.deprecatedNode()) ? positionInParentBeforeNode(*editablePosition.deprecatedNode()) : previousVisuallyDistinctCandidate(editablePosition);
if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecatedNode()->isDescendantOf(highestRoot))
if (editablePosition.deprecatedNode() && editablePosition.deprecatedNode() != highestRoot && !editablePosition.deprecatedNode()->isDescendantOf(highestRoot))
return VisiblePosition();
return VisiblePosition(p);
return VisiblePosition(editablePosition);
}
// FIXME: The method name, comment, and code say three different things here!
......
Markdown is supported
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