Commit 1a5edc77 authored by yoichio@chromium.org's avatar yoichio@chromium.org

[Editing][Codehealth] Replace Position::uptream/downstream to

mostBackward/ForwardCaretPosition

Position::upstream calls just VisibleUnit.cpp::mostForwardCaretPosition and also 
downstream:
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/c
ore/editing/Position.cpp&l=484&cl=GROK

This CL replaces it.
We will replace all upstream/downstream and remove them.

BUG=518738

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

git-svn-id: svn://svn.chromium.org/blink/trunk@200977 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 741bea9a
......@@ -163,7 +163,7 @@ PositionWithAffinity HitTestResult::position() const
if (!layoutObject)
return PositionWithAffinity();
if (m_innerPossiblyPseudoNode->isPseudoElement() && m_innerPossiblyPseudoNode->pseudoId() == BEFORE)
return Position(m_innerNode, PositionAnchorType::BeforeChildren).downstream();
return mostBackwardCaretPosition(Position(m_innerNode, PositionAnchorType::BeforeChildren));
return layoutObject->positionForPoint(localPoint());
}
......
......@@ -2992,10 +2992,10 @@ PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, TextAf
if (!node->hasEditableStyle()) {
// If it can be found, we prefer a visually equivalent position that is editable.
const Position position = Position(node, offset);
Position candidate = position.downstream(CanCrossEditingBoundary);
Position candidate = mostBackwardCaretPosition(position, CanCrossEditingBoundary);
if (candidate.anchorNode()->hasEditableStyle())
return PositionWithAffinity(candidate, affinity);
candidate = position.upstream(CanCrossEditingBoundary);
candidate = mostForwardCaretPosition(position, CanCrossEditingBoundary);
if (candidate.anchorNode()->hasEditableStyle())
return PositionWithAffinity(candidate, affinity);
}
......
......@@ -803,11 +803,11 @@ void LayoutView::commitPendingSelectionAlgorithm()
// as the start of the selection, the selection painting code will think that content on the line containing 'foo' is selected
// and will fill the gap before 'bar'.
PositionType startPos = Strategy::selectionStart(selection);
PositionType candidate = startPos.downstream();
PositionType candidate = mostBackwardCaretPosition(startPos);
if (isVisuallyEquivalentCandidate(candidate))
startPos = candidate;
PositionType endPos = Strategy::selectionEnd(selection);
candidate = endPos.upstream();
candidate = mostForwardCaretPosition(endPos);
if (isVisuallyEquivalentCandidate(candidate))
endPos = candidate;
......
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