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

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

Issue 2850773003: Use RelocatablePosition in CompositeEditCommand::MoveParagraphWithClones (Closed)
Patch Set: Remove yosin's TODO Created 3 years, 8 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/Source/core/editing/commands/ApplyBlockElementCommandTest.cpp ('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 285363d6d29c8996288642df124d96ca20f4e604..dbda1d3d4c9c363a16722380587c9f22bf2e4117 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -1266,9 +1266,10 @@ void CompositeEditCommand::MoveParagraphWithClones(
DCHECK(outer_node);
DCHECK(block_element);
- VisiblePosition before_paragraph =
- PreviousPositionOf(start_of_paragraph_to_move);
- VisiblePosition after_paragraph = NextPositionOf(end_of_paragraph_to_move);
+ RelocatablePosition relocatable_before_paragraph(
+ PreviousPositionOf(start_of_paragraph_to_move).DeepEquivalent());
+ RelocatablePosition relocatable_after_paragraph(
+ NextPositionOf(end_of_paragraph_to_move).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
@@ -1311,14 +1312,10 @@ void CompositeEditCommand::MoveParagraphWithClones(
// would cause 'baz' to collapse onto the line with 'foobar' unless we insert
// a br. Must recononicalize these two VisiblePositions after the pruning
// above.
- // TODO(yosin): We should abort when |beforeParagraph| is a orphan when
- // we have a sample.
- before_paragraph = CreateVisiblePosition(before_paragraph.DeepEquivalent());
- if (after_paragraph.IsOrphan()) {
- editing_state->Abort();
- return;
- }
- after_paragraph = CreateVisiblePosition(after_paragraph.DeepEquivalent());
+ const VisiblePosition& before_paragraph =
+ CreateVisiblePosition(relocatable_before_paragraph.GetPosition());
+ const VisiblePosition& after_paragraph =
+ CreateVisiblePosition(relocatable_after_paragraph.GetPosition());
if (before_paragraph.IsNotNull() &&
!IsDisplayInsideTable(before_paragraph.DeepEquivalent().AnchorNode()) &&
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommandTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698