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

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

Issue 2127503002: Use RelocatablePosition in CompositeEditCommand::moveParagraphs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased at 201607061743 Created 4 years, 5 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 | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
index c0d9030727ba5011dc26aa0840f4266a819d1eea..ae58cce1d8a8334d62d187c27a89cbe1347474b4 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -36,6 +36,7 @@
#include "core/editing/EditingUtilities.h"
#include "core/editing/Editor.h"
#include "core/editing/PlainTextRange.h"
+#include "core/editing/RelocatablePosition.h"
#include "core/editing/VisibleUnits.h"
#include "core/editing/commands/AppendNodeCommand.h"
#include "core/editing/commands/ApplyStyleCommand.h"
@@ -1282,8 +1283,8 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
}
}
- VisiblePosition beforeParagraph = previousPositionOf(startOfParagraphToMove, CannotCrossEditingBoundary);
- VisiblePosition afterParagraph = nextPositionOf(endOfParagraphToMove, CannotCrossEditingBoundary);
+ RelocatablePosition beforeParagraphPosition(previousPositionOf(startOfParagraphToMove, CannotCrossEditingBoundary).deepEquivalent());
+ RelocatablePosition afterParagraphPosition(nextPositionOf(endOfParagraphToMove, CannotCrossEditingBoundary).deepEquivalent());
// We upstream() the end and downstream() the start so that we don't include collapsed whitespace in the move.
// When we paste a fragment, spaces after the end and before the start are treated as though they were rendered.
@@ -1327,8 +1328,8 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
// Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. That would
// cause 'baz' to collapse onto the line with 'foobar' unless we insert a br.
// Must recononicalize these two VisiblePositions after the pruning above.
- beforeParagraph = createVisiblePosition(beforeParagraph.deepEquivalent());
- afterParagraph = createVisiblePosition(afterParagraph.deepEquivalent());
+ VisiblePosition beforeParagraph = createVisiblePosition(beforeParagraphPosition.position());
+ VisiblePosition afterParagraph = createVisiblePosition(afterParagraphPosition.position());
if (beforeParagraph.isNotNull() && (!isEndOfParagraph(beforeParagraph) || beforeParagraph.deepEquivalent() == afterParagraph.deepEquivalent())) {
// FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal.
insertNodeAt(HTMLBRElement::create(document()), beforeParagraph.deepEquivalent(), editingState);
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698