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

Side by Side 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 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 void Editor::reappliedEditing(EditCommandComposition* cmd) { 892 void Editor::reappliedEditing(EditCommandComposition* cmd) {
893 EventQueueScope scope; 893 EventQueueScope scope;
894 894
895 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), 895 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(),
896 cmd->endingRootEditableElement()); 896 cmd->endingRootEditableElement());
897 dispatchInputEventEditableContentChanged( 897 dispatchInputEventEditableContentChanged(
898 cmd->startingRootEditableElement(), cmd->endingRootEditableElement(), 898 cmd->startingRootEditableElement(), cmd->endingRootEditableElement(),
899 InputEvent::InputType::HistoryRedo, nullAtom, 899 InputEvent::InputType::HistoryRedo, nullAtom,
900 InputEvent::EventIsComposing::NotComposing); 900 InputEvent::EventIsComposing::NotComposing);
901 901
902 // TODO(yosin): Since |dispatchEditableContentChangedEvents()| and 902 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
903 // |dispatchInputEventEditableContentChanged()|, we would like to know 903 // needs to be audited. See http://crbug.com/590369 for more details.
904 // such case. Once we have a case, this |DCHECK()| should be replaced 904 // In the long term, we should stop editing commands from storing
905 // with if-statement. 905 // VisibleSelections as starting and ending selections.
906 DCHECK(frame().document()); 906 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
907 VisibleSelection newSelection(cmd->endingSelection()); 907 const VisibleSelection& newSelection =
908 if (newSelection.isValidFor(*frame().document())) 908 correctedVisibleSelection(cmd->endingSelection());
909 DCHECK(newSelection.isValidFor(*frame().document())) << newSelection;
910 if (!newSelection.isNone()) {
909 changeSelectionAfterCommand( 911 changeSelectionAfterCommand(
910 newSelection, 912 newSelection,
911 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); 913 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
914 }
912 915
913 m_lastEditCommand = nullptr; 916 m_lastEditCommand = nullptr;
914 m_undoStack->registerUndoStep(cmd); 917 m_undoStack->registerUndoStep(cmd);
915 respondToChangedContents(newSelection); 918 respondToChangedContents(newSelection);
916 } 919 }
917 920
918 Editor* Editor::create(LocalFrame& frame) { 921 Editor* Editor::create(LocalFrame& frame) {
919 return new Editor(frame); 922 return new Editor(frame);
920 } 923 }
921 924
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 } 1660 }
1658 1661
1659 DEFINE_TRACE(Editor) { 1662 DEFINE_TRACE(Editor) {
1660 visitor->trace(m_frame); 1663 visitor->trace(m_frame);
1661 visitor->trace(m_lastEditCommand); 1664 visitor->trace(m_lastEditCommand);
1662 visitor->trace(m_undoStack); 1665 visitor->trace(m_undoStack);
1663 visitor->trace(m_mark); 1666 visitor->trace(m_mark);
1664 } 1667 }
1665 1668
1666 } // namespace blink 1669 } // namespace blink
OLDNEW
« 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