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

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

Issue 2590283002: [InputEvent] Remove unused |inputType()| from |UndoStep| and |EditCommandComposition| (Closed)
Patch Set: 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
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "core/layout/line/InlineTextBox.h" 75 #include "core/layout/line/InlineTextBox.h"
76 #include <algorithm> 76 #include <algorithm>
77 77
78 namespace blink { 78 namespace blink {
79 79
80 using namespace HTMLNames; 80 using namespace HTMLNames;
81 81
82 EditCommandComposition* EditCommandComposition::create( 82 EditCommandComposition* EditCommandComposition::create(
83 Document* document, 83 Document* document,
84 const VisibleSelection& startingSelection, 84 const VisibleSelection& startingSelection,
85 const VisibleSelection& endingSelection, 85 const VisibleSelection& endingSelection) {
86 InputEvent::InputType inputType) {
87 return new EditCommandComposition(document, startingSelection, 86 return new EditCommandComposition(document, startingSelection,
88 endingSelection, inputType); 87 endingSelection);
89 } 88 }
90 89
91 EditCommandComposition::EditCommandComposition( 90 EditCommandComposition::EditCommandComposition(
92 Document* document, 91 Document* document,
93 const VisibleSelection& startingSelection, 92 const VisibleSelection& startingSelection,
94 const VisibleSelection& endingSelection, 93 const VisibleSelection& endingSelection)
95 InputEvent::InputType inputType)
96 : m_document(document), 94 : m_document(document),
97 m_startingSelection(startingSelection), 95 m_startingSelection(startingSelection),
98 m_endingSelection(endingSelection), 96 m_endingSelection(endingSelection),
99 m_startingRootEditableElement(startingSelection.rootEditableElement()), 97 m_startingRootEditableElement(startingSelection.rootEditableElement()),
100 m_endingRootEditableElement(endingSelection.rootEditableElement()), 98 m_endingRootEditableElement(endingSelection.rootEditableElement()) {}
101 m_inputType(inputType) {}
102 99
103 bool EditCommandComposition::belongsTo(const LocalFrame& frame) const { 100 bool EditCommandComposition::belongsTo(const LocalFrame& frame) const {
104 DCHECK(m_document); 101 DCHECK(m_document);
105 return m_document->frame() == &frame; 102 return m_document->frame() == &frame;
106 } 103 }
107 104
108 void EditCommandComposition::unapply(EditCommandSource source) { 105 void EditCommandComposition::unapply(EditCommandSource source) {
109 DCHECK(m_document); 106 DCHECK(m_document);
110 LocalFrame* frame = m_document->frame(); 107 LocalFrame* frame = m_document->frame();
111 DCHECK(frame); 108 DCHECK(frame);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 bool EditCommandComposition::willUnapply(EditCommandSource) { 152 bool EditCommandComposition::willUnapply(EditCommandSource) {
156 // TODO(chongz): Fire 'beforeinput' for 'historyUndo'. 153 // TODO(chongz): Fire 'beforeinput' for 'historyUndo'.
157 return true; 154 return true;
158 } 155 }
159 156
160 bool EditCommandComposition::willReapply(EditCommandSource) { 157 bool EditCommandComposition::willReapply(EditCommandSource) {
161 // TODO(chongz): Fire 'beforeinput' for 'historyRedo'. 158 // TODO(chongz): Fire 'beforeinput' for 'historyRedo'.
162 return true; 159 return true;
163 } 160 }
164 161
165 InputEvent::InputType EditCommandComposition::inputType() const {
166 return m_inputType;
167 }
168
169 void EditCommandComposition::append(SimpleEditCommand* command) { 162 void EditCommandComposition::append(SimpleEditCommand* command) {
170 m_commands.push_back(command); 163 m_commands.push_back(command);
171 } 164 }
172 165
173 void EditCommandComposition::append(EditCommandComposition* composition) { 166 void EditCommandComposition::append(EditCommandComposition* composition) {
174 m_commands.appendVector(composition->m_commands); 167 m_commands.appendVector(composition->m_commands);
175 } 168 }
176 169
177 void EditCommandComposition::setStartingSelection( 170 void EditCommandComposition::setStartingSelection(
178 const VisibleSelection& selection) { 171 const VisibleSelection& selection) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (!isTypingCommand()) 248 if (!isTypingCommand())
256 frame->editor().appliedEditing(this); 249 frame->editor().appliedEditing(this);
257 setShouldRetainAutocorrectionIndicator(false); 250 setShouldRetainAutocorrectionIndicator(false);
258 return !editingState.isAborted(); 251 return !editingState.isAborted();
259 } 252 }
260 253
261 EditCommandComposition* CompositeEditCommand::ensureComposition() { 254 EditCommandComposition* CompositeEditCommand::ensureComposition() {
262 CompositeEditCommand* command = this; 255 CompositeEditCommand* command = this;
263 while (command && command->parent()) 256 while (command && command->parent())
264 command = command->parent(); 257 command = command->parent();
265 if (!command->m_composition) 258 if (!command->m_composition) {
266 command->m_composition = EditCommandComposition::create( 259 command->m_composition = EditCommandComposition::create(
267 &document(), startingSelection(), endingSelection(), inputType()); 260 &document(), startingSelection(), endingSelection());
261 }
268 return command->m_composition.get(); 262 return command->m_composition.get();
269 } 263 }
270 264
271 bool CompositeEditCommand::willApplyEditing(EditCommandSource) { 265 bool CompositeEditCommand::willApplyEditing(EditCommandSource) {
272 // TODO(chongz): Move all the 'beforeinput' dispatching logic here. 266 // TODO(chongz): Move all the 'beforeinput' dispatching logic here.
273 return true; 267 return true;
274 } 268 }
275 269
276 bool CompositeEditCommand::preservesTypingStyle() const { 270 bool CompositeEditCommand::preservesTypingStyle() const {
277 return false; 271 return false;
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 return node; 2047 return node;
2054 } 2048 }
2055 2049
2056 DEFINE_TRACE(CompositeEditCommand) { 2050 DEFINE_TRACE(CompositeEditCommand) {
2057 visitor->trace(m_commands); 2051 visitor->trace(m_commands);
2058 visitor->trace(m_composition); 2052 visitor->trace(m_composition);
2059 EditCommand::trace(visitor); 2053 EditCommand::trace(visitor);
2060 } 2054 }
2061 2055
2062 } // namespace blink 2056 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698