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

Unified Diff: third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp

Issue 2534783002: Apply RelocatablePosition in DeleteSelectionCommand::mergeParagraphs (Closed)
Patch Set: Tue Nov 29 21:12:11 JST 2016 Created 4 years, 1 month 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: third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
index 70053020f158deb01a3fbf748da9a939eb708654..2f1bc1a12e1d5855f2fac0a965b1c7f7d27a2b54 100644
--- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
@@ -818,6 +818,8 @@ void DeleteSelectionCommand::mergeParagraphs(EditingState* editingState) {
return;
}
+ RelocatablePosition relocatableStart(startOfParagraphToMove.deepEquivalent());
+
// We need to merge into m_upstreamStart's block, but it's been emptied out
// and collapsed by deletion.
if (!mergeDestination.deepEquivalent().anchorNode() ||
@@ -828,16 +830,13 @@ void DeleteSelectionCommand::mergeParagraphs(EditingState* editingState) {
(m_startsAtEmptyLine &&
mergeDestination.deepEquivalent() !=
startOfParagraphToMove.deepEquivalent())) {
- PositionWithAffinity storedStartOfParagraphToMove =
- startOfParagraphToMove.toPositionWithAffinity();
insertNodeAt(HTMLBRElement::create(document()), m_upstreamStart,
editingState);
if (editingState->isAborted())
return;
document().updateStyleAndLayoutIgnorePendingStylesheets();
mergeDestination = createVisiblePosition(m_upstreamStart);
- startOfParagraphToMove =
- createVisiblePosition(storedStartOfParagraphToMove);
+ startOfParagraphToMove = createVisiblePosition(relocatableStart.position());
}
if (mergeDestination.deepEquivalent() ==
@@ -886,7 +885,7 @@ void DeleteSelectionCommand::mergeParagraphs(EditingState* editingState) {
editingState);
if (editingState->isAborted())
return;
- m_endingPosition = startOfParagraphToMove.deepEquivalent();
+ m_endingPosition = relocatableStart.position();
return;
}
}

Powered by Google App Engine
This is Rietveld 408576698