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

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

Issue 2131113002: Make CompositeEditCommand::moveParagraph() to abort when destination becomes invisible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-20T17:11:32 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/editing/execCommand/apply_style/justify_full_without_body_crash.html ('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 574420ae0a473fee3ffe37c92549827fa4972b0f..a0a7e3dd9a427bcb3fd356f2c86ff50d667260ac 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -1341,8 +1341,13 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
destinationIndex = TextIterator::rangeLength(Position::firstPositionInNode(document().documentElement()), destination.toParentAnchoredPosition(), true);
- setEndingSelection(VisibleSelection(destination, originalIsDirectional));
- DCHECK(!endingSelection().isNone());
+ VisibleSelection destinationSelection(destination, originalIsDirectional);
+ if (endingSelection().isNone()) {
+ // We abort executing command since |destination| becomes invisible.
+ editingState->abort();
+ return;
+ }
+ setEndingSelection(destinationSelection);
ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MovingParagraph;
if (shouldPreserveStyle == DoNotPreserveStyle)
options |= ReplaceSelectionCommand::MatchStyle;
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/apply_style/justify_full_without_body_crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698