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

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

Issue 2639483002: Add sequence number to undo steps (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 EditCommandComposition::EditCommandComposition( 91 EditCommandComposition::EditCommandComposition(
92 Document* document, 92 Document* document,
93 const VisibleSelection& startingSelection, 93 const VisibleSelection& startingSelection,
94 const VisibleSelection& endingSelection, 94 const VisibleSelection& endingSelection,
95 InputEvent::InputType inputType) 95 InputEvent::InputType inputType)
96 : m_document(document), 96 : m_document(document),
97 m_startingSelection(startingSelection), 97 m_startingSelection(startingSelection),
98 m_endingSelection(endingSelection), 98 m_endingSelection(endingSelection),
99 m_startingRootEditableElement(startingSelection.rootEditableElement()), 99 m_startingRootEditableElement(startingSelection.rootEditableElement()),
100 m_endingRootEditableElement(endingSelection.rootEditableElement()), 100 m_endingRootEditableElement(endingSelection.rootEditableElement()),
101 m_inputType(inputType) {} 101 m_inputType(inputType),
102 m_sequence(0) {}
102 103
103 bool EditCommandComposition::belongsTo(const LocalFrame& frame) const { 104 bool EditCommandComposition::belongsTo(const LocalFrame& frame) const {
104 DCHECK(m_document); 105 DCHECK(m_document);
105 return m_document->frame() == &frame; 106 return m_document->frame() == &frame;
106 } 107 }
107 108
108 void EditCommandComposition::unapply() { 109 void EditCommandComposition::unapply() {
109 DCHECK(m_document); 110 DCHECK(m_document);
110 LocalFrame* frame = m_document->frame(); 111 LocalFrame* frame = m_document->frame();
111 DCHECK(frame); 112 DCHECK(frame);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 command->doReapply(); 144 command->doReapply();
144 } 145 }
145 146
146 frame->editor().reappliedEditing(this); 147 frame->editor().reappliedEditing(this);
147 } 148 }
148 149
149 InputEvent::InputType EditCommandComposition::inputType() const { 150 InputEvent::InputType EditCommandComposition::inputType() const {
150 return m_inputType; 151 return m_inputType;
151 } 152 }
152 153
154 int EditCommandComposition::sequence() const {
155 return m_sequence;
156 }
157
158 void EditCommandComposition::setSequence(int sequence) {
159 m_sequence = sequence;
160 }
161
153 void EditCommandComposition::append(SimpleEditCommand* command) { 162 void EditCommandComposition::append(SimpleEditCommand* command) {
154 m_commands.push_back(command); 163 m_commands.push_back(command);
155 } 164 }
156 165
157 void EditCommandComposition::append(EditCommandComposition* composition) { 166 void EditCommandComposition::append(EditCommandComposition* composition) {
158 m_commands.appendVector(composition->m_commands); 167 m_commands.appendVector(composition->m_commands);
159 } 168 }
160 169
161 void EditCommandComposition::setStartingSelection( 170 void EditCommandComposition::setStartingSelection(
162 const VisibleSelection& selection) { 171 const VisibleSelection& selection) {
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 return node; 2039 return node;
2031 } 2040 }
2032 2041
2033 DEFINE_TRACE(CompositeEditCommand) { 2042 DEFINE_TRACE(CompositeEditCommand) {
2034 visitor->trace(m_commands); 2043 visitor->trace(m_commands);
2035 visitor->trace(m_composition); 2044 visitor->trace(m_composition);
2036 EditCommand::trace(visitor); 2045 EditCommand::trace(visitor);
2037 } 2046 }
2038 2047
2039 } // namespace blink 2048 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698