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

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

Issue 1307803003: Introduce nextPositionOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T18:13:02 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
« no previous file with comments | « Source/core/editing/commands/InsertListCommand.cpp ('k') | Source/core/editing/commands/TypingCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/commands/ReplaceSelectionCommand.cpp
diff --git a/Source/core/editing/commands/ReplaceSelectionCommand.cpp b/Source/core/editing/commands/ReplaceSelectionCommand.cpp
index e826e79a1114aa18825d2e07923fa6d8809b3081..31828d10e0784c4168242deab03af366bc8ac57a 100644
--- a/Source/core/editing/commands/ReplaceSelectionCommand.cpp
+++ b/Source/core/editing/commands/ReplaceSelectionCommand.cpp
@@ -422,7 +422,7 @@ bool ReplaceSelectionCommand::shouldMergeStart(bool selectionStartWasStartOfPara
bool ReplaceSelectionCommand::shouldMergeEnd(bool selectionEndWasEndOfParagraph)
{
VisiblePosition endOfInsertedContent(positionAtEndOfInsertedContent());
- VisiblePosition next = endOfInsertedContent.next(CannotCrossEditingBoundary);
+ VisiblePosition next = nextPositionOf(endOfInsertedContent, CannotCrossEditingBoundary);
if (next.isNull())
return false;
@@ -842,8 +842,8 @@ void ReplaceSelectionCommand::mergeEndIfNeeded()
// block styles.
bool mergeForward = !(inSameParagraph(startOfInsertedContent, endOfInsertedContent) && !isStartOfParagraph(startOfInsertedContent));
- VisiblePosition destination = mergeForward ? endOfInsertedContent.next() : endOfInsertedContent;
- VisiblePosition startOfParagraphToMove = mergeForward ? startOfParagraph(endOfInsertedContent) : endOfInsertedContent.next();
+ VisiblePosition destination = mergeForward ? nextPositionOf(endOfInsertedContent) : endOfInsertedContent;
+ VisiblePosition startOfParagraphToMove = mergeForward ? startOfParagraph(endOfInsertedContent) : nextPositionOf(endOfInsertedContent);
// Merging forward could result in deleting the destination anchor node.
// To avoid this, we add a placeholder node before the start of the paragraph.
@@ -977,7 +977,7 @@ void ReplaceSelectionCommand::doApply()
if (fragment.hasInterchangeNewlineAtStart()) {
if (isEndOfParagraph(visibleStart) && !isStartOfParagraph(visibleStart)) {
if (!isEndOfEditableOrNonEditableContent(visibleStart))
- setEndingSelection(visibleStart.next());
+ setEndingSelection(nextPositionOf(visibleStart));
} else {
insertParagraphSeparator();
}
@@ -986,7 +986,7 @@ void ReplaceSelectionCommand::doApply()
} else {
ASSERT(selection.isCaret());
if (fragment.hasInterchangeNewlineAtStart()) {
- VisiblePosition next = visibleStart.next(CannotCrossEditingBoundary);
+ VisiblePosition next = nextPositionOf(visibleStart, CannotCrossEditingBoundary);
if (isEndOfParagraph(visibleStart) && !isStartOfParagraph(visibleStart) && next.isNotNull()) {
setEndingSelection(next);
} else {
@@ -1227,7 +1227,7 @@ void ReplaceSelectionCommand::doApply()
Position lastPositionToSelect;
if (fragment.hasInterchangeNewlineAtEnd()) {
VisiblePosition endOfInsertedContent = positionAtEndOfInsertedContent();
- VisiblePosition next = endOfInsertedContent.next(CannotCrossEditingBoundary);
+ VisiblePosition next = nextPositionOf(endOfInsertedContent, CannotCrossEditingBoundary);
if (selectionEndWasEndOfParagraph || !isEndOfParagraph(endOfInsertedContent) || next.isNull()) {
if (!isStartOfParagraph(endOfInsertedContent)) {
« no previous file with comments | « Source/core/editing/commands/InsertListCommand.cpp ('k') | Source/core/editing/commands/TypingCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698