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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 class KillRing; 52 class KillRing;
53 class Pasteboard; 53 class Pasteboard;
54 class SpellChecker; 54 class SpellChecker;
55 class StylePropertySet; 55 class StylePropertySet;
56 class TextEvent; 56 class TextEvent;
57 class UndoStack; 57 class UndoStack;
58 58
59 enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM }; 59 enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM };
60 enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSe paratorIsP }; 60 enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSe paratorIsP };
61 61
62 class CORE_EXPORT Editor final : public NoBaseWillBeGarbageCollectedFinalized<Ed itor> { 62 class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
63 USING_FAST_MALLOC_WILL_BE_REMOVED(Editor);
64 WTF_MAKE_NONCOPYABLE(Editor); 63 WTF_MAKE_NONCOPYABLE(Editor);
65 public: 64 public:
66 static PassOwnPtrWillBeRawPtr<Editor> create(LocalFrame&); 65 static RawPtr<Editor> create(LocalFrame&);
67 ~Editor(); 66 ~Editor();
68 67
69 EditorClient& client() const; 68 EditorClient& client() const;
70 69
71 CompositeEditCommand* lastEditCommand() { return m_lastEditCommand.get(); } 70 CompositeEditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
72 71
73 void handleKeyboardEvent(KeyboardEvent*); 72 void handleKeyboardEvent(KeyboardEvent*);
74 bool handleTextEvent(TextEvent*); 73 bool handleTextEvent(TextEvent*);
75 74
76 bool canEdit() const; 75 bool canEdit() const;
(...skipping 30 matching lines...) Expand all
107 void clearLastEditCommand(); 106 void clearLastEditCommand();
108 107
109 bool deleteWithDirection(SelectionDirection, TextGranularity, bool killRing, bool isTypingAction); 108 bool deleteWithDirection(SelectionDirection, TextGranularity, bool killRing, bool isTypingAction);
110 void deleteSelectionWithSmartDelete(bool smartDelete); 109 void deleteSelectionWithSmartDelete(bool smartDelete);
111 110
112 void applyStyle(StylePropertySet*, EditAction = EditActionUnspecified); 111 void applyStyle(StylePropertySet*, EditAction = EditActionUnspecified);
113 void applyParagraphStyle(StylePropertySet*, EditAction = EditActionUnspecifi ed); 112 void applyParagraphStyle(StylePropertySet*, EditAction = EditActionUnspecifi ed);
114 void applyStyleToSelection(StylePropertySet*, EditAction); 113 void applyStyleToSelection(StylePropertySet*, EditAction);
115 void applyParagraphStyleToSelection(StylePropertySet*, EditAction); 114 void applyParagraphStyleToSelection(StylePropertySet*, EditAction);
116 115
117 void appliedEditing(PassRefPtrWillBeRawPtr<CompositeEditCommand>); 116 void appliedEditing(RawPtr<CompositeEditCommand>);
118 void unappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>); 117 void unappliedEditing(RawPtr<EditCommandComposition>);
119 void reappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>); 118 void reappliedEditing(RawPtr<EditCommandComposition>);
120 119
121 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; } 120 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; }
122 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; } 121 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; }
123 122
124 class CORE_EXPORT Command { 123 class CORE_EXPORT Command {
125 STACK_ALLOCATED(); 124 STACK_ALLOCATED();
126 public: 125 public:
127 Command(); 126 Command();
128 Command(const EditorInternalCommand*, EditorCommandSource, PassRefPtrWil lBeRawPtr<LocalFrame>); 127 Command(const EditorInternalCommand*, EditorCommandSource, RawPtr<LocalF rame>);
129 128
130 bool execute(const String& parameter = String(), Event* triggeringEvent = nullptr) const; 129 bool execute(const String& parameter = String(), Event* triggeringEvent = nullptr) const;
131 bool execute(Event* triggeringEvent) const; 130 bool execute(Event* triggeringEvent) const;
132 131
133 bool isSupported() const; 132 bool isSupported() const;
134 bool isEnabled(Event* triggeringEvent = nullptr) const; 133 bool isEnabled(Event* triggeringEvent = nullptr) const;
135 134
136 TriState state(Event* triggeringEvent = nullptr) const; 135 TriState state(Event* triggeringEvent = nullptr) const;
137 String value(Event* triggeringEvent = nullptr) const; 136 String value(Event* triggeringEvent = nullptr) const;
138 137
139 bool isTextInsertion() const; 138 bool isTextInsertion() const;
140 139
141 // Returns 0 if this Command is not supported. 140 // Returns 0 if this Command is not supported.
142 int idForHistogram() const; 141 int idForHistogram() const;
143 private: 142 private:
144 LocalFrame& frame() const 143 LocalFrame& frame() const
145 { 144 {
146 ASSERT(m_frame); 145 ASSERT(m_frame);
147 return *m_frame; 146 return *m_frame;
148 } 147 }
149 148
150 const EditorInternalCommand* m_command; 149 const EditorInternalCommand* m_command;
151 EditorCommandSource m_source; 150 EditorCommandSource m_source;
152 RefPtrWillBeMember<LocalFrame> m_frame; 151 Member<LocalFrame> m_frame;
153 }; 152 };
154 Command createCommand(const String& commandName); // Command source is Comma ndFromMenuOrKeyBinding. 153 Command createCommand(const String& commandName); // Command source is Comma ndFromMenuOrKeyBinding.
155 Command createCommand(const String& commandName, EditorCommandSource); 154 Command createCommand(const String& commandName, EditorCommandSource);
156 155
157 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand| 156 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand|
158 // rather than |Document::execCommand|. 157 // rather than |Document::execCommand|.
159 bool executeCommand(const String&); 158 bool executeCommand(const String&);
160 bool executeCommand(const String& commandName, const String& value); 159 bool executeCommand(const String& commandName, const String& value);
161 160
162 bool insertText(const String&, KeyboardEvent* triggeringEvent); 161 bool insertText(const String&, KeyboardEvent* triggeringEvent);
(...skipping 25 matching lines...) Expand all
188 VisibleSelection selectionForCommand(Event*); 187 VisibleSelection selectionForCommand(Event*);
189 188
190 KillRing& killRing() const { return *m_killRing; } 189 KillRing& killRing() const { return *m_killRing; }
191 190
192 EditingBehavior behavior() const; 191 EditingBehavior behavior() const;
193 192
194 EphemeralRange selectedRange(); 193 EphemeralRange selectedRange();
195 194
196 void addToKillRing(const EphemeralRange&); 195 void addToKillRing(const EphemeralRange&);
197 196
198 void pasteAsFragment(PassRefPtrWillBeRawPtr<DocumentFragment>, bool smartRep lace, bool matchStyle); 197 void pasteAsFragment(RawPtr<DocumentFragment>, bool smartReplace, bool match Style);
199 void pasteAsPlainText(const String&, bool smartReplace); 198 void pasteAsPlainText(const String&, bool smartReplace);
200 199
201 Element* findEventTargetFrom(const VisibleSelection&) const; 200 Element* findEventTargetFrom(const VisibleSelection&) const;
202 201
203 bool findString(const String&, FindOptions); 202 bool findString(const String&, FindOptions);
204 203
205 PassRefPtrWillBeRawPtr<Range> findStringAndScrollToVisible(const String&, Ra nge*, FindOptions); 204 RawPtr<Range> findStringAndScrollToVisible(const String&, Range*, FindOption s);
206 PassRefPtrWillBeRawPtr<Range> findRangeOfString(const String& target, const EphemeralRange& referenceRange, FindOptions); 205 RawPtr<Range> findRangeOfString(const String& target, const EphemeralRange& referenceRange, FindOptions);
207 PassRefPtrWillBeRawPtr<Range> findRangeOfString(const String& target, const EphemeralRangeInFlatTree& referenceRange, FindOptions); 206 RawPtr<Range> findRangeOfString(const String& target, const EphemeralRangeIn FlatTree& referenceRange, FindOptions);
208 207
209 const VisibleSelection& mark() const; // Mark, to be used as emacs uses it. 208 const VisibleSelection& mark() const; // Mark, to be used as emacs uses it.
210 void setMark(const VisibleSelection&); 209 void setMark(const VisibleSelection&);
211 210
212 void computeAndSetTypingStyle(StylePropertySet* , EditAction = EditActionUns pecified); 211 void computeAndSetTypingStyle(StylePropertySet* , EditAction = EditActionUns pecified);
213 212
214 IntRect firstRectForRange(const EphemeralRange&) const; 213 IntRect firstRectForRange(const EphemeralRange&) const;
215 IntRect firstRectForRange(const Range*) const; 214 IntRect firstRectForRange(const Range*) const;
216 215
217 void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSe lection::SetSelectionOptions); 216 void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSe lection::SetSelectionOptions);
218 217
219 bool markedTextMatchesAreHighlighted() const; 218 bool markedTextMatchesAreHighlighted() const;
220 void setMarkedTextMatchesAreHighlighted(bool); 219 void setMarkedTextMatchesAreHighlighted(bool);
221 220
222 void replaceSelectionWithFragment(PassRefPtrWillBeRawPtr<DocumentFragment>, bool selectReplacement, bool smartReplace, bool matchStyle); 221 void replaceSelectionWithFragment(RawPtr<DocumentFragment>, bool selectRepla cement, bool smartReplace, bool matchStyle);
223 void replaceSelectionWithText(const String&, bool selectReplacement, bool sm artReplace); 222 void replaceSelectionWithText(const String&, bool selectReplacement, bool sm artReplace);
224 223
225 // TODO(xiaochengh): Replace |bool| parameters by |enum|. 224 // TODO(xiaochengh): Replace |bool| parameters by |enum|.
226 void replaceSelectionAfterDragging(PassRefPtrWillBeRawPtr<DocumentFragment>, bool smartReplace, bool plainText); 225 void replaceSelectionAfterDragging(RawPtr<DocumentFragment>, bool smartRepla ce, bool plainText);
227 void moveSelectionAfterDragging(PassRefPtrWillBeRawPtr<DocumentFragment>, co nst Position&, bool smartInsert, bool smartDelete); 226 void moveSelectionAfterDragging(RawPtr<DocumentFragment>, const Position&, b ool smartInsert, bool smartDelete);
228 227
229 EditorParagraphSeparator defaultParagraphSeparator() const { return m_defaul tParagraphSeparator; } 228 EditorParagraphSeparator defaultParagraphSeparator() const { return m_defaul tParagraphSeparator; }
230 void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { m_de faultParagraphSeparator = separator; } 229 void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { m_de faultParagraphSeparator = separator; }
231 230
232 static void tidyUpHTMLStructure(Document&); 231 static void tidyUpHTMLStructure(Document&);
233 232
234 class RevealSelectionScope { 233 class RevealSelectionScope {
235 WTF_MAKE_NONCOPYABLE(RevealSelectionScope); 234 WTF_MAKE_NONCOPYABLE(RevealSelectionScope);
236 STACK_ALLOCATED(); 235 STACK_ALLOCATED();
237 public: 236 public:
238 explicit RevealSelectionScope(Editor*); 237 explicit RevealSelectionScope(Editor*);
239 ~RevealSelectionScope(); 238 ~RevealSelectionScope();
240 private: 239 private:
241 RawPtrWillBeMember<Editor> m_editor; 240 Member<Editor> m_editor;
242 }; 241 };
243 friend class RevealSelectionScope; 242 friend class RevealSelectionScope;
244 243
245 DECLARE_TRACE(); 244 DECLARE_TRACE();
246 245
247 private: 246 private:
248 RawPtrWillBeMember<LocalFrame> m_frame; 247 Member<LocalFrame> m_frame;
249 RefPtrWillBeMember<CompositeEditCommand> m_lastEditCommand; 248 Member<CompositeEditCommand> m_lastEditCommand;
250 int m_preventRevealSelection; 249 int m_preventRevealSelection;
251 bool m_shouldStartNewKillRingSequence; 250 bool m_shouldStartNewKillRingSequence;
252 bool m_shouldStyleWithCSS; 251 bool m_shouldStyleWithCSS;
253 const OwnPtr<KillRing> m_killRing; 252 const OwnPtr<KillRing> m_killRing;
254 VisibleSelection m_mark; 253 VisibleSelection m_mark;
255 bool m_areMarkedTextMatchesHighlighted; 254 bool m_areMarkedTextMatchesHighlighted;
256 EditorParagraphSeparator m_defaultParagraphSeparator; 255 EditorParagraphSeparator m_defaultParagraphSeparator;
257 bool m_overwriteModeEnabled; 256 bool m_overwriteModeEnabled;
258 257
259 explicit Editor(LocalFrame&); 258 explicit Editor(LocalFrame&);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 307
309 inline bool Editor::markedTextMatchesAreHighlighted() const 308 inline bool Editor::markedTextMatchesAreHighlighted() const
310 { 309 {
311 return m_areMarkedTextMatchesHighlighted; 310 return m_areMarkedTextMatchesHighlighted;
312 } 311 }
313 312
314 313
315 } // namespace blink 314 } // namespace blink
316 315
317 #endif // Editor_h 316 #endif // Editor_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/EditingUtilitiesTest.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