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

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

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Back out non-Oilpan experiment + tidy up by adding frame() ref accessors Created 6 years, 3 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSe paratorIsP }; 64 enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSe paratorIsP };
65 65
66 class Editor FINAL : public NoBaseWillBeGarbageCollectedFinalized<Editor> { 66 class Editor FINAL : public NoBaseWillBeGarbageCollectedFinalized<Editor> {
67 WTF_MAKE_NONCOPYABLE(Editor); 67 WTF_MAKE_NONCOPYABLE(Editor);
68 public: 68 public:
69 static PassOwnPtrWillBeRawPtr<Editor> create(LocalFrame&); 69 static PassOwnPtrWillBeRawPtr<Editor> create(LocalFrame&);
70 ~Editor(); 70 ~Editor();
71 71
72 EditorClient& client() const; 72 EditorClient& client() const;
73 73
74 LocalFrame& frame() const { return m_frame; }
75
76 CompositeEditCommand* lastEditCommand() { return m_lastEditCommand.get(); } 74 CompositeEditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
77 75
78 void handleKeyboardEvent(KeyboardEvent*); 76 void handleKeyboardEvent(KeyboardEvent*);
79 bool handleTextEvent(TextEvent*); 77 bool handleTextEvent(TextEvent*);
80 78
81 bool canEdit() const; 79 bool canEdit() const;
82 bool canEditRichly() const; 80 bool canEditRichly() const;
83 81
84 bool canDHTMLCut(); 82 bool canDHTMLCut();
85 bool canDHTMLCopy(); 83 bool canDHTMLCopy();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void applyParagraphStyleToSelection(StylePropertySet*, EditAction); 121 void applyParagraphStyleToSelection(StylePropertySet*, EditAction);
124 122
125 void appliedEditing(PassRefPtrWillBeRawPtr<CompositeEditCommand>); 123 void appliedEditing(PassRefPtrWillBeRawPtr<CompositeEditCommand>);
126 void unappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>); 124 void unappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>);
127 void reappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>); 125 void reappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>);
128 126
129 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; } 127 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; }
130 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; } 128 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; }
131 129
132 class Command { 130 class Command {
131 STACK_ALLOCATED();
133 public: 132 public:
134 Command(); 133 Command();
135 Command(const EditorInternalCommand*, EditorCommandSource, PassRefPtr<Lo calFrame>); 134 Command(const EditorInternalCommand*, EditorCommandSource, PassRefPtrWil lBeRawPtr<LocalFrame>);
136 135
137 bool execute(const String& parameter = String(), Event* triggeringEvent = 0) const; 136 bool execute(const String& parameter = String(), Event* triggeringEvent = 0) const;
138 bool execute(Event* triggeringEvent) const; 137 bool execute(Event* triggeringEvent) const;
139 138
140 bool isSupported() const; 139 bool isSupported() const;
141 bool isEnabled(Event* triggeringEvent = 0) const; 140 bool isEnabled(Event* triggeringEvent = 0) const;
142 141
143 TriState state(Event* triggeringEvent = 0) const; 142 TriState state(Event* triggeringEvent = 0) const;
144 String value(Event* triggeringEvent = 0) const; 143 String value(Event* triggeringEvent = 0) const;
145 144
146 bool isTextInsertion() const; 145 bool isTextInsertion() const;
147 146
148 // Returns 0 if this Command is not supported. 147 // Returns 0 if this Command is not supported.
149 int idForHistogram() const; 148 int idForHistogram() const;
150 private: 149 private:
150 LocalFrame& frame() const { return *m_frame; }
151
151 const EditorInternalCommand* m_command; 152 const EditorInternalCommand* m_command;
152 EditorCommandSource m_source; 153 EditorCommandSource m_source;
153 RefPtr<LocalFrame> m_frame; 154 RefPtrWillBeMember<LocalFrame> m_frame;
154 }; 155 };
155 Command command(const String& commandName); // Command source is CommandFrom MenuOrKeyBinding. 156 Command command(const String& commandName); // Command source is CommandFrom MenuOrKeyBinding.
156 Command command(const String& commandName, EditorCommandSource); 157 Command command(const String& commandName, EditorCommandSource);
157 158
158 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand| 159 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand|
159 // rather than |Document::execCommand|. 160 // rather than |Document::execCommand|.
160 bool executeCommand(const String&); 161 bool executeCommand(const String&);
161 bool executeCommand(const String& commandName, const String& value); 162 bool executeCommand(const String& commandName, const String& value);
162 163
163 bool insertText(const String&, KeyboardEvent* triggeringEvent); 164 bool insertText(const String&, KeyboardEvent* triggeringEvent);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 RevealSelectionScope(Editor*); 232 RevealSelectionScope(Editor*);
232 ~RevealSelectionScope(); 233 ~RevealSelectionScope();
233 private: 234 private:
234 Editor* m_editor; 235 Editor* m_editor;
235 }; 236 };
236 friend class RevealSelectionScope; 237 friend class RevealSelectionScope;
237 238
238 void trace(Visitor*); 239 void trace(Visitor*);
239 240
240 private: 241 private:
241 LocalFrame& m_frame; 242 RawPtrWillBeMember<LocalFrame> m_frame;
242 RefPtrWillBeMember<CompositeEditCommand> m_lastEditCommand; 243 RefPtrWillBeMember<CompositeEditCommand> m_lastEditCommand;
243 int m_preventRevealSelection; 244 int m_preventRevealSelection;
244 bool m_shouldStartNewKillRingSequence; 245 bool m_shouldStartNewKillRingSequence;
245 bool m_shouldStyleWithCSS; 246 bool m_shouldStyleWithCSS;
246 const OwnPtr<KillRing> m_killRing; 247 const OwnPtr<KillRing> m_killRing;
247 VisibleSelection m_mark; 248 VisibleSelection m_mark;
248 bool m_areMarkedTextMatchesHighlighted; 249 bool m_areMarkedTextMatchesHighlighted;
249 EditorParagraphSeparator m_defaultParagraphSeparator; 250 EditorParagraphSeparator m_defaultParagraphSeparator;
250 bool m_overwriteModeEnabled; 251 bool m_overwriteModeEnabled;
251 252
252 explicit Editor(LocalFrame&); 253 explicit Editor(LocalFrame&);
253 254
255 LocalFrame& frame() const { return *m_frame; }
256
254 bool canDeleteRange(Range*) const; 257 bool canDeleteRange(Range*) const;
255 258
256 UndoStack* undoStack() const; 259 UndoStack* undoStack() const;
257 260
258 bool tryDHTMLCopy(); 261 bool tryDHTMLCopy();
259 bool tryDHTMLCut(); 262 bool tryDHTMLCut();
260 bool tryDHTMLPaste(PasteMode); 263 bool tryDHTMLPaste(PasteMode);
261 264
262 bool canSmartReplaceWithPasteboard(Pasteboard*); 265 bool canSmartReplaceWithPasteboard(Pasteboard*);
263 void pasteAsPlainTextWithPasteboard(Pasteboard*); 266 void pasteAsPlainTextWithPasteboard(Pasteboard*);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 298
296 inline bool Editor::markedTextMatchesAreHighlighted() const 299 inline bool Editor::markedTextMatchesAreHighlighted() const
297 { 300 {
298 return m_areMarkedTextMatchesHighlighted; 301 return m_areMarkedTextMatchesHighlighted;
299 } 302 }
300 303
301 304
302 } // namespace blink 305 } // namespace blink
303 306
304 #endif // Editor_h 307 #endif // Editor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698