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

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

Issue 2635963004: Revert of [EditCommandSource] Pass source from |Editor::Command| to |Editor::apply*()/insert*( (2/3) (Closed)
Patch Set: Fix revert conflcts 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | 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 Apple Inc. All rights reserved. 2 * Copyright (C) 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 16 matching lines...) Expand all
27 #define Editor_h 27 #define Editor_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/clipboard/DataTransferAccessPolicy.h" 30 #include "core/clipboard/DataTransferAccessPolicy.h"
31 #include "core/editing/EditingBehavior.h" 31 #include "core/editing/EditingBehavior.h"
32 #include "core/editing/EphemeralRange.h" 32 #include "core/editing/EphemeralRange.h"
33 #include "core/editing/FindOptions.h" 33 #include "core/editing/FindOptions.h"
34 #include "core/editing/FrameSelection.h" 34 #include "core/editing/FrameSelection.h"
35 #include "core/editing/VisibleSelection.h" 35 #include "core/editing/VisibleSelection.h"
36 #include "core/editing/WritingDirection.h" 36 #include "core/editing/WritingDirection.h"
37 #include "core/editing/commands/CompositeEditCommand.h"
38 #include "core/editing/iterators/TextIterator.h" 37 #include "core/editing/iterators/TextIterator.h"
39 #include "core/editing/markers/DocumentMarker.h" 38 #include "core/editing/markers/DocumentMarker.h"
40 #include "core/events/InputEvent.h" 39 #include "core/events/InputEvent.h"
41 #include "platform/PasteMode.h" 40 #include "platform/PasteMode.h"
42 #include "platform/heap/Handle.h" 41 #include "platform/heap/Handle.h"
43 #include <memory> 42 #include <memory>
44 43
45 namespace blink { 44 namespace blink {
46 45
47 class CompositeEditCommand; 46 class CompositeEditCommand;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 bool canCut() const; 91 bool canCut() const;
93 bool canCopy() const; 92 bool canCopy() const;
94 bool canPaste() const; 93 bool canPaste() const;
95 bool canDelete() const; 94 bool canDelete() const;
96 bool canSmartCopyOrDelete() const; 95 bool canSmartCopyOrDelete() const;
97 96
98 void cut(EditCommandSource); 97 void cut(EditCommandSource);
99 void copy(); 98 void copy();
100 void paste(EditCommandSource); 99 void paste(EditCommandSource);
101 void pasteAsPlainText(EditCommandSource); 100 void pasteAsPlainText(EditCommandSource);
102 void performDelete(EditCommandSource); 101 void performDelete();
103 102
104 static void countEvent(ExecutionContext*, const Event*); 103 static void countEvent(ExecutionContext*, const Event*);
105 void copyImage(const HitTestResult&); 104 void copyImage(const HitTestResult&);
106 105
107 void transpose(EditCommandSource); 106 void transpose();
108 107
109 void respondToChangedContents(const VisibleSelection& endingSelection); 108 void respondToChangedContents(const VisibleSelection& endingSelection);
110 109
111 bool selectionStartHasStyle(CSSPropertyID, const String& value) const; 110 bool selectionStartHasStyle(CSSPropertyID, const String& value) const;
112 TriState selectionHasStyle(CSSPropertyID, const String& value) const; 111 TriState selectionHasStyle(CSSPropertyID, const String& value) const;
113 String selectionStartCSSPropertyValue(CSSPropertyID); 112 String selectionStartCSSPropertyValue(CSSPropertyID);
114 113
115 void removeFormattingAndStyle(EditCommandSource); 114 void removeFormattingAndStyle();
116 115
117 void registerCommandGroup(CompositeEditCommand* commandGroupWrapper); 116 void registerCommandGroup(CompositeEditCommand* commandGroupWrapper);
118 void clearLastEditCommand(); 117 void clearLastEditCommand();
119 118
120 bool deleteWithDirection(EditCommandSource, 119 bool deleteWithDirection(DeleteDirection,
121 DeleteDirection,
122 TextGranularity, 120 TextGranularity,
123 bool killRing, 121 bool killRing,
124 bool isTypingAction); 122 bool isTypingAction);
125 void deleteSelectionWithSmartDelete( 123 void deleteSelectionWithSmartDelete(
126 EditCommandSource,
127 DeleteMode, 124 DeleteMode,
128 InputEvent::InputType, 125 InputEvent::InputType,
129 const Position& referenceMovePosition = Position()); 126 const Position& referenceMovePosition = Position());
130 127
131 void applyStyle(EditCommandSource, StylePropertySet*, InputEvent::InputType); 128 void applyStyle(StylePropertySet*, InputEvent::InputType);
132 void applyParagraphStyle(EditCommandSource, 129 void applyParagraphStyle(StylePropertySet*, InputEvent::InputType);
133 StylePropertySet*, 130 void applyStyleToSelection(StylePropertySet*, InputEvent::InputType);
134 InputEvent::InputType); 131 void applyParagraphStyleToSelection(StylePropertySet*, InputEvent::InputType);
135 void applyStyleToSelection(EditCommandSource,
136 StylePropertySet*,
137 InputEvent::InputType);
138 void applyParagraphStyleToSelection(EditCommandSource,
139 StylePropertySet*,
140 InputEvent::InputType);
141 132
142 void appliedEditing(CompositeEditCommand*); 133 void appliedEditing(CompositeEditCommand*);
143 void unappliedEditing(EditCommandComposition*); 134 void unappliedEditing(EditCommandComposition*);
144 void reappliedEditing(EditCommandComposition*); 135 void reappliedEditing(EditCommandComposition*);
145 136
146 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; } 137 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; }
147 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; } 138 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; }
148 139
149 class CORE_EXPORT Command { 140 class CORE_EXPORT Command {
150 STACK_ALLOCATED(); 141 STACK_ALLOCATED();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 Command createCommand(const String& commandName); 177 Command createCommand(const String& commandName);
187 // Command source is |EditCommandSource::kDOM|. 178 // Command source is |EditCommandSource::kDOM|.
188 Command createCommandFromDOM(const String& commandName); 179 Command createCommandFromDOM(const String& commandName);
189 180
190 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand| 181 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand|
191 // rather than |Document::execCommand|. 182 // rather than |Document::execCommand|.
192 bool executeCommand(const String&); 183 bool executeCommand(const String&);
193 bool executeCommand(const String& commandName, const String& value); 184 bool executeCommand(const String& commandName, const String& value);
194 185
195 bool insertText(const String&, KeyboardEvent* triggeringEvent); 186 bool insertText(const String&, KeyboardEvent* triggeringEvent);
196 bool insertTextWithoutSendingTextEvent(EditCommandSource, 187 bool insertTextWithoutSendingTextEvent(const String&,
197 const String&,
198 bool selectInsertedText, 188 bool selectInsertedText,
199 TextEvent* triggeringEvent); 189 TextEvent* triggeringEvent);
200 bool insertLineBreak(); 190 bool insertLineBreak();
201 bool insertParagraphSeparator(); 191 bool insertParagraphSeparator();
202 192
203 bool isOverwriteModeEnabled() const { return m_overwriteModeEnabled; } 193 bool isOverwriteModeEnabled() const { return m_overwriteModeEnabled; }
204 void toggleOverwriteModeEnabled(); 194 void toggleOverwriteModeEnabled();
205 195
206 bool canUndo(); 196 bool canUndo();
207 void undo(EditCommandSource); 197 void undo();
208 bool canRedo(); 198 bool canRedo();
209 void redo(EditCommandSource); 199 void redo();
210 200
211 void setBaseWritingDirection(WritingDirection); 201 void setBaseWritingDirection(WritingDirection);
212 202
213 // smartInsertDeleteEnabled and selectTrailingWhitespaceEnabled are 203 // smartInsertDeleteEnabled and selectTrailingWhitespaceEnabled are
214 // mutually exclusive, meaning that enabling one will disable the other. 204 // mutually exclusive, meaning that enabling one will disable the other.
215 bool smartInsertDeleteEnabled() const; 205 bool smartInsertDeleteEnabled() const;
216 bool isSelectTrailingWhitespaceEnabled() const; 206 bool isSelectTrailingWhitespaceEnabled() const;
217 207
218 bool preventRevealSelection() const { return m_preventRevealSelection; } 208 bool preventRevealSelection() const { return m_preventRevealSelection; }
219 209
(...skipping 23 matching lines...) Expand all
243 Range* findRangeOfString(const String& target, 233 Range* findRangeOfString(const String& target,
244 const EphemeralRange& referenceRange, 234 const EphemeralRange& referenceRange,
245 FindOptions); 235 FindOptions);
246 Range* findRangeOfString(const String& target, 236 Range* findRangeOfString(const String& target,
247 const EphemeralRangeInFlatTree& referenceRange, 237 const EphemeralRangeInFlatTree& referenceRange,
248 FindOptions); 238 FindOptions);
249 239
250 const VisibleSelection& mark() const; // Mark, to be used as emacs uses it. 240 const VisibleSelection& mark() const; // Mark, to be used as emacs uses it.
251 void setMark(const VisibleSelection&); 241 void setMark(const VisibleSelection&);
252 242
253 void computeAndSetTypingStyle(EditCommandSource, 243 void computeAndSetTypingStyle(StylePropertySet*, InputEvent::InputType);
254 StylePropertySet*,
255 InputEvent::InputType);
256 244
257 // |firstRectForRange| requires up-to-date layout. 245 // |firstRectForRange| requires up-to-date layout.
258 IntRect firstRectForRange(const EphemeralRange&) const; 246 IntRect firstRectForRange(const EphemeralRange&) const;
259 247
260 void respondToChangedSelection(const Position& oldSelectionStart, 248 void respondToChangedSelection(const Position& oldSelectionStart,
261 FrameSelection::SetSelectionOptions); 249 FrameSelection::SetSelectionOptions);
262 250
263 bool markedTextMatchesAreHighlighted() const; 251 bool markedTextMatchesAreHighlighted() const;
264 void setMarkedTextMatchesAreHighlighted(bool); 252 void setMarkedTextMatchesAreHighlighted(bool);
265 253
266 void replaceSelectionWithFragment(EditCommandSource, 254 void replaceSelectionWithFragment(DocumentFragment*,
267 DocumentFragment*,
268 bool selectReplacement, 255 bool selectReplacement,
269 bool smartReplace, 256 bool smartReplace,
270 bool matchStyle, 257 bool matchStyle,
271 InputEvent::InputType); 258 InputEvent::InputType);
272 void replaceSelectionWithText(EditCommandSource, 259 void replaceSelectionWithText(const String&,
273 const String&,
274 bool selectReplacement, 260 bool selectReplacement,
275 bool smartReplace, 261 bool smartReplace,
276 InputEvent::InputType); 262 InputEvent::InputType);
277 263
278 // Implementation of WebLocalFrameImpl::replaceSelection. 264 // Implementation of WebLocalFrameImpl::replaceSelection.
279 void replaceSelection(const String&); 265 void replaceSelection(const String&);
280 // Implementation of SpellChecker::replaceMisspelledRange.
281 void replaceSelectionForSpellChecker(const String&);
282 266
283 void replaceSelectionAfterDragging(DocumentFragment*, 267 void replaceSelectionAfterDragging(DocumentFragment*,
284 InsertMode, 268 InsertMode,
285 DragSourceType); 269 DragSourceType);
286 270
287 // Return false if frame was destroyed by event handler, should stop executing 271 // Return false if frame was destroyed by event handler, should stop executing
288 // remaining actions. 272 // remaining actions.
289 bool deleteSelectionAfterDraggingWithEvents( 273 bool deleteSelectionAfterDraggingWithEvents(
290 Element* dragSource, 274 Element* dragSource,
291 DeleteMode, 275 DeleteMode,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 m_mark = selection; 364 m_mark = selection;
381 } 365 }
382 366
383 inline bool Editor::markedTextMatchesAreHighlighted() const { 367 inline bool Editor::markedTextMatchesAreHighlighted() const {
384 return m_areMarkedTextMatchesHighlighted; 368 return m_areMarkedTextMatchesHighlighted;
385 } 369 }
386 370
387 } // namespace blink 371 } // namespace blink
388 372
389 #endif // Editor_h 373 #endif // Editor_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698