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

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

Issue 2531263002: Abort CompositeEditCommand::moveParagraphs if destination is inside moving range (Closed)
Patch Set: 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/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 ebbb4448045ba7e261463ccc4d95b5974397afbc..29a17ac75d586f4724334baaaa8010122d4aa1ac 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -1511,6 +1511,14 @@ void CompositeEditCommand::moveParagraphs(
startOfParagraphToMove.isNull())
return;
+ // Can't move the range to a destination inside itself.
+ if (destination.deepEquivalent() > startOfParagraphToMove.deepEquivalent() &&
+ destination.deepEquivalent() < endOfParagraphToMove.deepEquivalent()) {
+ // Reached by unit test TypingCommandTest.insertLineBreakWithIllFormedHTML
+ editingState->abort();
+ return;
+ }
+
int startIndex = -1;
int endIndex = -1;
int destinationIndex = -1;
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/editing/commands/TypingCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698