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

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

Issue 2532393002: Make redo command to correct selection in undo stack (Closed)
Patch Set: 2016-11-30T11:28:33 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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/undo/redo_correct_selection.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 93f0e2a4535eaedd77b800c188d7a62d5ce01e3d..c1d7b1601c31f25d33007acffabad03502910b9f 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -899,16 +899,19 @@ void Editor::reappliedEditing(EditCommandComposition* cmd) {
InputEvent::InputType::HistoryRedo, nullAtom,
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());
- if (newSelection.isValidFor(*frame().document()))
+ // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ // In the long term, we should stop editing commands from storing
+ // VisibleSelections as starting and ending selections.
+ frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+ const VisibleSelection& newSelection =
+ correctedVisibleSelection(cmd->endingSelection());
+ DCHECK(newSelection.isValidFor(*frame().document())) << newSelection;
+ if (!newSelection.isNone()) {
changeSelectionAfterCommand(
newSelection,
FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
+ }
m_lastEditCommand = nullptr;
m_undoStack->registerUndoStep(cmd);
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/undo/redo_correct_selection.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698