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

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

Issue 2578753002: [EditCommandSource] Rename and move |EditorCommandSource| to "CompositeEditCommand.h" (1/3) (Closed)
Patch Set: Xiaocheng and tkent's review: Rename to |EditCommandSource| and use kCamelCase 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) 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class EditorInternalCommand; 50 class EditorInternalCommand;
51 class LocalFrame; 51 class LocalFrame;
52 class HitTestResult; 52 class HitTestResult;
53 class KillRing; 53 class KillRing;
54 class Pasteboard; 54 class Pasteboard;
55 class SpellChecker; 55 class SpellChecker;
56 class StylePropertySet; 56 class StylePropertySet;
57 class TextEvent; 57 class TextEvent;
58 class UndoStack; 58 class UndoStack;
59 59
60 enum class EditCommandSource;
60 enum class DeleteDirection; 61 enum class DeleteDirection;
61 enum class DeleteMode { Simple, Smart }; 62 enum class DeleteMode { Simple, Smart };
62 enum class InsertMode { Simple, Smart }; 63 enum class InsertMode { Simple, Smart };
63 enum class DragSourceType { HTMLSource, PlainTextSource }; 64 enum class DragSourceType { HTMLSource, PlainTextSource };
64 65
65 enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM };
66 enum EditorParagraphSeparator { 66 enum EditorParagraphSeparator {
67 EditorParagraphSeparatorIsDiv, 67 EditorParagraphSeparatorIsDiv,
68 EditorParagraphSeparatorIsP 68 EditorParagraphSeparatorIsP
69 }; 69 };
70 70
71 class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> { 71 class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
72 WTF_MAKE_NONCOPYABLE(Editor); 72 WTF_MAKE_NONCOPYABLE(Editor);
73 73
74 public: 74 public:
75 static Editor* create(LocalFrame&); 75 static Editor* create(LocalFrame&);
(...skipping 11 matching lines...) Expand all
87 87
88 bool canDHTMLCut(); 88 bool canDHTMLCut();
89 bool canDHTMLCopy(); 89 bool canDHTMLCopy();
90 90
91 bool canCut() const; 91 bool canCut() const;
92 bool canCopy() const; 92 bool canCopy() const;
93 bool canPaste() const; 93 bool canPaste() const;
94 bool canDelete() const; 94 bool canDelete() const;
95 bool canSmartCopyOrDelete() const; 95 bool canSmartCopyOrDelete() const;
96 96
97 void cut(EditorCommandSource); 97 void cut(EditCommandSource);
98 void copy(); 98 void copy();
99 void paste(EditorCommandSource); 99 void paste(EditCommandSource);
100 void pasteAsPlainText(EditorCommandSource); 100 void pasteAsPlainText(EditCommandSource);
101 void performDelete(); 101 void performDelete();
102 102
103 static void countEvent(ExecutionContext*, const Event*); 103 static void countEvent(ExecutionContext*, const Event*);
104 void copyImage(const HitTestResult&); 104 void copyImage(const HitTestResult&);
105 105
106 void transpose(); 106 void transpose();
107 107
108 void respondToChangedContents(const VisibleSelection& endingSelection); 108 void respondToChangedContents(const VisibleSelection& endingSelection);
109 109
110 bool selectionStartHasStyle(CSSPropertyID, const String& value) const; 110 bool selectionStartHasStyle(CSSPropertyID, const String& value) const;
(...skipping 24 matching lines...) Expand all
135 void reappliedEditing(EditCommandComposition*); 135 void reappliedEditing(EditCommandComposition*);
136 136
137 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; } 137 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; }
138 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; } 138 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; }
139 139
140 class CORE_EXPORT Command { 140 class CORE_EXPORT Command {
141 STACK_ALLOCATED(); 141 STACK_ALLOCATED();
142 142
143 public: 143 public:
144 Command(); 144 Command();
145 Command(const EditorInternalCommand*, EditorCommandSource, LocalFrame*); 145 Command(const EditorInternalCommand*, EditCommandSource, LocalFrame*);
146 146
147 bool execute(const String& parameter = String(), 147 bool execute(const String& parameter = String(),
148 Event* triggeringEvent = nullptr) const; 148 Event* triggeringEvent = nullptr) const;
149 bool execute(Event* triggeringEvent) const; 149 bool execute(Event* triggeringEvent) const;
150 150
151 bool isSupported() const; 151 bool isSupported() const;
152 bool isEnabled(Event* triggeringEvent = nullptr) const; 152 bool isEnabled(Event* triggeringEvent = nullptr) const;
153 153
154 TriState state(Event* triggeringEvent = nullptr) const; 154 TriState state(Event* triggeringEvent = nullptr) const;
155 String value(Event* triggeringEvent = nullptr) const; 155 String value(Event* triggeringEvent = nullptr) const;
156 156
157 bool isTextInsertion() const; 157 bool isTextInsertion() const;
158 158
159 // Returns 0 if this Command is not supported. 159 // Returns 0 if this Command is not supported.
160 int idForHistogram() const; 160 int idForHistogram() const;
161 161
162 private: 162 private:
163 LocalFrame& frame() const { 163 LocalFrame& frame() const {
164 DCHECK(m_frame); 164 DCHECK(m_frame);
165 return *m_frame; 165 return *m_frame;
166 } 166 }
167 167
168 // Returns target ranges for the command, currently only supports delete 168 // Returns target ranges for the command, currently only supports delete
169 // related commands. Used by InputEvent. 169 // related commands. Used by InputEvent.
170 RangeVector* getTargetRanges() const; 170 RangeVector* getTargetRanges() const;
171 171
172 const EditorInternalCommand* m_command; 172 const EditorInternalCommand* m_command;
173 EditorCommandSource m_source; 173 EditCommandSource m_source;
174 Member<LocalFrame> m_frame; 174 Member<LocalFrame> m_frame;
175 }; 175 };
176 Command createCommand( 176 // Command source is |EditCommandSource::kMenuOrKeyBinding|.
177 const String& 177 Command createCommand(const String& commandName);
178 commandName); // Command source is CommandFromMenuOrKeyBinding. 178 // Command source is |EditCommandSource::kDOM|.
179 Command createCommand(const String& commandName, EditorCommandSource); 179 Command createCommandFromDOM(const String& commandName);
180 180
181 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand| 181 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand|
182 // rather than |Document::execCommand|. 182 // rather than |Document::execCommand|.
183 bool executeCommand(const String&); 183 bool executeCommand(const String&);
184 bool executeCommand(const String& commandName, const String& value); 184 bool executeCommand(const String& commandName, const String& value);
185 185
186 bool insertText(const String&, KeyboardEvent* triggeringEvent); 186 bool insertText(const String&, KeyboardEvent* triggeringEvent);
187 bool insertTextWithoutSendingTextEvent(const String&, 187 bool insertTextWithoutSendingTextEvent(const String&,
188 bool selectInsertedText, 188 bool selectInsertedText,
189 TextEvent* triggeringEvent); 189 TextEvent* triggeringEvent);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 m_mark = selection; 364 m_mark = selection;
365 } 365 }
366 366
367 inline bool Editor::markedTextMatchesAreHighlighted() const { 367 inline bool Editor::markedTextMatchesAreHighlighted() const {
368 return m_areMarkedTextMatchesHighlighted; 368 return m_areMarkedTextMatchesHighlighted;
369 } 369 }
370 370
371 } // namespace blink 371 } // namespace blink
372 372
373 #endif // Editor_h 373 #endif // Editor_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698