Commit d7a61b79 authored by yoichio@chromium.org's avatar yoichio@chromium.org

Revert of [Editing][Codehealth] Replace Position::uptream/downstream to...

Revert of [Editing][Codehealth] Replace Position::uptream/downstream to mostBackward/ForwardCaretPosition. (patchset #1 id:1 of https://codereview.chromium.org/1306743002/ )

Reason for revert:
This patch misused each other.
See:
 https://codereview.chromium.org/1310433004/

Original issue's description:
> [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
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=200977

TBR=yosin@chromium.org,tkent@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=518738

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

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