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

Side by Side Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2540613002: Re-factor Editor::unappliedEditing() (Closed)
Patch Set: 2016-11-29T17:47:51 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 | « no previous file | 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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 cmd->startingRootEditableElement(), cmd->endingRootEditableElement(), 868 cmd->startingRootEditableElement(), cmd->endingRootEditableElement(),
869 InputEvent::InputType::HistoryUndo, nullAtom, 869 InputEvent::InputType::HistoryUndo, nullAtom,
870 InputEvent::EventIsComposing::NotComposing); 870 InputEvent::EventIsComposing::NotComposing);
871 871
872 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets 872 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
873 // needs to be audited. See http://crbug.com/590369 for more details. 873 // needs to be audited. See http://crbug.com/590369 for more details.
874 // In the long term, we should stop editing commands from storing 874 // In the long term, we should stop editing commands from storing
875 // VisibleSelections as starting and ending selections. 875 // VisibleSelections as starting and ending selections.
876 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets(); 876 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
877 877
878 VisibleSelection newSelection = 878 const VisibleSelection& newSelection =
879 correctedVisibleSelection(cmd->startingSelection()); 879 correctedVisibleSelection(cmd->startingSelection());
880 if (newSelection.start().document() == frame().document() && 880 DCHECK(newSelection.isValidFor(*frame().document())) << newSelection;
881 newSelection.end().document() == frame().document()) 881 if (!newSelection.isNone()) {
882 changeSelectionAfterCommand( 882 changeSelectionAfterCommand(
883 newSelection, 883 newSelection,
884 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); 884 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
885 }
885 886
886 m_lastEditCommand = nullptr; 887 m_lastEditCommand = nullptr;
887 m_undoStack->registerRedoStep(cmd); 888 m_undoStack->registerRedoStep(cmd);
888 respondToChangedContents(newSelection); 889 respondToChangedContents(newSelection);
889 } 890 }
890 891
891 void Editor::reappliedEditing(EditCommandComposition* cmd) { 892 void Editor::reappliedEditing(EditCommandComposition* cmd) {
892 EventQueueScope scope; 893 EventQueueScope scope;
893 894
894 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), 895 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(),
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 } 1657 }
1657 1658
1658 DEFINE_TRACE(Editor) { 1659 DEFINE_TRACE(Editor) {
1659 visitor->trace(m_frame); 1660 visitor->trace(m_frame);
1660 visitor->trace(m_lastEditCommand); 1661 visitor->trace(m_lastEditCommand);
1661 visitor->trace(m_undoStack); 1662 visitor->trace(m_undoStack);
1662 visitor->trace(m_mark); 1663 visitor->trace(m_mark);
1663 } 1664 }
1664 1665
1665 } // namespace blink 1666 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698