OLD | NEW |
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...) Loading... |
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; } | 74 LocalFrame& frame() const { return *m_frame; } |
75 | 75 |
76 CompositeEditCommand* lastEditCommand() { return m_lastEditCommand.get(); } | 76 CompositeEditCommand* lastEditCommand() { return m_lastEditCommand.get(); } |
77 | 77 |
78 void handleKeyboardEvent(KeyboardEvent*); | 78 void handleKeyboardEvent(KeyboardEvent*); |
79 bool handleTextEvent(TextEvent*); | 79 bool handleTextEvent(TextEvent*); |
80 | 80 |
81 bool canEdit() const; | 81 bool canEdit() const; |
82 bool canEditRichly() const; | 82 bool canEditRichly() const; |
83 | 83 |
84 bool canDHTMLCut(); | 84 bool canDHTMLCut(); |
(...skipping 38 matching lines...) Loading... |
123 void applyParagraphStyleToSelection(StylePropertySet*, EditAction); | 123 void applyParagraphStyleToSelection(StylePropertySet*, EditAction); |
124 | 124 |
125 void appliedEditing(PassRefPtrWillBeRawPtr<CompositeEditCommand>); | 125 void appliedEditing(PassRefPtrWillBeRawPtr<CompositeEditCommand>); |
126 void unappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>); | 126 void unappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>); |
127 void reappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>); | 127 void reappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition>); |
128 | 128 |
129 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; } | 129 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; } |
130 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; } | 130 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; } |
131 | 131 |
132 class Command { | 132 class Command { |
| 133 STACK_ALLOCATED(); |
133 public: | 134 public: |
134 Command(); | 135 Command(); |
135 Command(const EditorInternalCommand*, EditorCommandSource, PassRefPtr<Lo
calFrame>); | 136 Command(const EditorInternalCommand*, EditorCommandSource, PassRefPtrWil
lBeRawPtr<LocalFrame>); |
136 | 137 |
137 bool execute(const String& parameter = String(), Event* triggeringEvent
= 0) const; | 138 bool execute(const String& parameter = String(), Event* triggeringEvent
= 0) const; |
138 bool execute(Event* triggeringEvent) const; | 139 bool execute(Event* triggeringEvent) const; |
139 | 140 |
140 bool isSupported() const; | 141 bool isSupported() const; |
141 bool isEnabled(Event* triggeringEvent = 0) const; | 142 bool isEnabled(Event* triggeringEvent = 0) const; |
142 | 143 |
143 TriState state(Event* triggeringEvent = 0) const; | 144 TriState state(Event* triggeringEvent = 0) const; |
144 String value(Event* triggeringEvent = 0) const; | 145 String value(Event* triggeringEvent = 0) const; |
145 | 146 |
146 bool isTextInsertion() const; | 147 bool isTextInsertion() const; |
147 | 148 |
148 // Returns 0 if this Command is not supported. | 149 // Returns 0 if this Command is not supported. |
149 int idForHistogram() const; | 150 int idForHistogram() const; |
150 private: | 151 private: |
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...) Loading... |
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 |
(...skipping 43 matching lines...) Loading... |
295 | 296 |
296 inline bool Editor::markedTextMatchesAreHighlighted() const | 297 inline bool Editor::markedTextMatchesAreHighlighted() const |
297 { | 298 { |
298 return m_areMarkedTextMatchesHighlighted; | 299 return m_areMarkedTextMatchesHighlighted; |
299 } | 300 } |
300 | 301 |
301 | 302 |
302 } // namespace blink | 303 } // namespace blink |
303 | 304 |
304 #endif // Editor_h | 305 #endif // Editor_h |
OLD | NEW |