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

Unified Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2120223002: Make redo command not to set invalid selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-04T15:06:28 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/undo/redo-selection-modify-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/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index 74818e022a20ffb40cba3ae648826a4ca11c544f..07e3fc167a377e360d0d2e73b9571f722364a9ae 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -810,8 +810,14 @@ void Editor::reappliedEditing(EditCommandComposition* cmd)
dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
dispatchInputEventEditableContentChanged(cmd->startingRootEditableElement(), cmd->endingRootEditableElement(), InputEvent::InputType::Redo, emptyString(), InputEvent::EventIsComposing::NotComposing);
+ // TODO(yosin): Since |dispatchEditableContentChangedEvents()| and
+ // |dispatchInputEventEditableContentChanged()|, we would like to know
+ // such case. Once we have a case, this |DCHECK()| should be replaced
+ // with if-statement.
+ DCHECK(frame().document());
VisibleSelection newSelection(cmd->endingSelection());
- changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
+ if (newSelection.isValidFor(*frame().document()))
Xiaocheng 2016/07/04 08:01:37 The fix looks fine to me, but for curiosity: It s
yosin_UTC9 2016/07/04 09:57:07 I may not understand you question fully... Anythi
+ changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
m_lastEditCommand = nullptr;
if (UndoStack* undoStack = this->undoStack())
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/undo/redo-selection-modify-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698