Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Unified Diff: Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp

Issue 1302353002: Get rid of redundant member function PositionAlgorithm<Strategy>::{upstream,downstream} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-22T04:51:20 Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp
diff --git a/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp b/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp
index b6699d7c2b89ffc9ab58f8b3687a1a090845ebdf..7ca8bc22686d090490671f9b2f6ca7764459a194 100644
--- a/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp
+++ b/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp
@@ -183,9 +183,9 @@ void InsertParagraphSeparatorCommand::doApply()
}
// Use the leftmost candidate.
- insertionPosition = insertionPosition.upstream();
+ insertionPosition = mostBackwardCaretPosition(insertionPosition);
if (!isVisuallyEquivalentCandidate(insertionPosition))
- insertionPosition = insertionPosition.downstream();
+ insertionPosition = mostForwardCaretPosition(insertionPosition);
// Adjust the insertion position after the delete
insertionPosition = positionAvoidingSpecialElementBoundary(insertionPosition);
@@ -290,7 +290,7 @@ void InsertParagraphSeparatorCommand::doApply()
}
// find ending selection position easily before inserting the paragraph
- insertionPosition = insertionPosition.downstream();
+ insertionPosition = mostForwardCaretPosition(insertionPosition);
if (refNode)
insertNodeBefore(blockToInsert, refNode);
@@ -328,7 +328,7 @@ void InsertParagraphSeparatorCommand::doApply()
// Move downstream. Typing style code will take care of carrying along the
// style of the upstream position.
- insertionPosition = insertionPosition.downstream();
+ insertionPosition = mostForwardCaretPosition(insertionPosition);
// At this point, the insertionPosition's node could be a container, and we want to make sure we include
// all of the correct nodes when building the ancestor list. So this needs to be the deepest representation of the position
@@ -339,13 +339,13 @@ void InsertParagraphSeparatorCommand::doApply()
// we should move to its upstream or downstream position.
if (editingIgnoresContent(insertionPosition.anchorNode())) {
if (insertionPosition.atLastEditingPositionForNode())
- insertionPosition = insertionPosition.downstream();
+ insertionPosition = mostForwardCaretPosition(insertionPosition);
else if (insertionPosition.atFirstEditingPositionForNode())
- insertionPosition = insertionPosition.upstream();
+ insertionPosition = mostBackwardCaretPosition(insertionPosition);
}
// Make sure we do not cause a rendered space to become unrendered.
- // FIXME: We need the affinity for pos, but pos.downstream() does not give it
+ // FIXME: We need the affinity for pos, but mostForwardCaretPosition does not give it
Position leadingWhitespace = leadingWhitespacePosition(insertionPosition, VP_DEFAULT_AFFINITY);
// FIXME: leadingWhitespacePosition is returning the position before preserved newlines for positions
// after the preserved newline, causing the newline to be turned into a nbsp.
« no previous file with comments | « Source/core/editing/commands/InsertListCommand.cpp ('k') | Source/core/editing/commands/InsertTextCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698