OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 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 13 matching lines...) Expand all Loading... | |
24 */ | 24 */ |
25 | 25 |
26 #ifndef CompositeEditCommand_h | 26 #ifndef CompositeEditCommand_h |
27 #define CompositeEditCommand_h | 27 #define CompositeEditCommand_h |
28 | 28 |
29 #include "core/CSSPropertyNames.h" | 29 #include "core/CSSPropertyNames.h" |
30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
31 #include "core/editing/commands/EditCommand.h" | 31 #include "core/editing/commands/EditCommand.h" |
32 #include "core/editing/commands/EditingState.h" | 32 #include "core/editing/commands/EditingState.h" |
33 #include "core/editing/commands/UndoStep.h" | 33 #include "core/editing/commands/UndoStep.h" |
34 #include "core/events/InputEvent.h" | |
34 #include "wtf/Vector.h" | 35 #include "wtf/Vector.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 class EditingStyle; | 39 class EditingStyle; |
39 class Element; | 40 class Element; |
40 class HTMLBRElement; | 41 class HTMLBRElement; |
41 class HTMLElement; | 42 class HTMLElement; |
42 class HTMLSpanElement; | 43 class HTMLSpanElement; |
43 class Text; | 44 class Text; |
(...skipping 25 matching lines...) Expand all Loading... | |
69 return m_endingRootEditableElement.get(); | 70 return m_endingRootEditableElement.get(); |
70 } | 71 } |
71 | 72 |
72 DECLARE_VIRTUAL_TRACE(); | 73 DECLARE_VIRTUAL_TRACE(); |
73 | 74 |
74 private: | 75 private: |
75 EditCommandComposition(Document*, | 76 EditCommandComposition(Document*, |
76 const VisibleSelection& startingSelection, | 77 const VisibleSelection& startingSelection, |
77 const VisibleSelection& endingSelection); | 78 const VisibleSelection& endingSelection); |
78 | 79 |
79 // TODO(chongz): Implement "beforeinput" as described below: | 80 // Fires "beforeinput" and will return |false| to cancel unapply / reapply if |
80 // Fires "beforeinput" and will returns |false| to cancel unapply / reapply if | |
81 // * "beforeinput" was canceled, or | 81 // * "beforeinput" was canceled, or |
82 // * |frame| was destroyed by event handlers. | 82 // * |frame| was destroyed by event handlers. |
83 // Note: Undo stack will always get popped. | 83 // Note: Undo stack will always get popped. |
84 bool willUnapply(EditCommandSource); | 84 bool willUnapply(EditCommandSource); |
85 bool willReapply(EditCommandSource); | 85 bool willReapply(EditCommandSource); |
86 | 86 |
87 Member<Document> m_document; | 87 Member<Document> m_document; |
88 VisibleSelection m_startingSelection; | 88 VisibleSelection m_startingSelection; |
89 VisibleSelection m_endingSelection; | 89 VisibleSelection m_endingSelection; |
90 HeapVector<Member<SimpleEditCommand>> m_commands; | 90 HeapVector<Member<SimpleEditCommand>> m_commands; |
(...skipping 19 matching lines...) Expand all Loading... | |
110 void appendCommandToComposite(CompositeEditCommand*); | 110 void appendCommandToComposite(CompositeEditCommand*); |
111 | 111 |
112 virtual bool isReplaceSelectionCommand() const; | 112 virtual bool isReplaceSelectionCommand() const; |
113 virtual bool isTypingCommand() const; | 113 virtual bool isTypingCommand() const; |
114 virtual bool isCommandGroupWrapper() const; | 114 virtual bool isCommandGroupWrapper() const; |
115 virtual bool isDragAndDropCommand() const; | 115 virtual bool isDragAndDropCommand() const; |
116 virtual bool preservesTypingStyle() const; | 116 virtual bool preservesTypingStyle() const; |
117 virtual void setShouldRetainAutocorrectionIndicator(bool); | 117 virtual void setShouldRetainAutocorrectionIndicator(bool); |
118 virtual bool shouldStopCaretBlinking() const { return false; } | 118 virtual bool shouldStopCaretBlinking() const { return false; } |
119 | 119 |
120 virtual InputEvent::InputType inputType() const; | |
chongz
2016/12/20 23:27:52
Moved from |EditCommand::inputType()|.
| |
121 // |TypingCommand| will return the text of the last |m_commands|. | |
122 virtual String textDataForInputEvent() const; | |
chongz
2016/12/20 23:27:52
Moved from |EditCommand::textDataForInputEvent()|.
| |
123 virtual DataTransfer* dataTransferForInputEvent() const; | |
chongz
2016/12/20 23:27:52
New method.
| |
124 virtual RangeVector* targetRangesForInputEvent() const; | |
chongz
2016/12/20 23:27:52
New method.
| |
125 | |
120 DECLARE_VIRTUAL_TRACE(); | 126 DECLARE_VIRTUAL_TRACE(); |
121 | 127 |
122 protected: | 128 protected: |
123 explicit CompositeEditCommand(Document&); | 129 explicit CompositeEditCommand(Document&); |
124 | 130 |
125 // TODO(chongz): Implement "beforeinput" as described below: | |
126 // Fires "beforeinput" and will return |false| to cancel applying editing if | 131 // Fires "beforeinput" and will return |false| to cancel applying editing if |
127 // * "beforeinput" was canceled, or | 132 // * "beforeinput" was canceled, or |
128 // * |frame| was destroyed by event handlers. | 133 // * |frame| was destroyed by event handlers. |
129 // |willApplyEditing()| should be called from | 134 // |willApplyEditing()| should be called from |
130 // * |CompositeEditCommand::apply()|, and | 135 // * |CompositeEditCommand::apply()|, and |
131 // * |TypingCommand::willAddTypingToOpenCommand()|. | 136 // * |TypingCommand::willAddTypingToOpenCommand()|. |
132 bool willApplyEditing(EditCommandSource); | 137 bool willApplyEditing(EditCommandSource); |
133 | 138 |
134 // | 139 // |
135 // sugary-sweet convenience functions to help create and apply edit commands | 140 // sugary-sweet convenience functions to help create and apply edit commands |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 | 290 |
286 DEFINE_TYPE_CASTS(CompositeEditCommand, | 291 DEFINE_TYPE_CASTS(CompositeEditCommand, |
287 EditCommand, | 292 EditCommand, |
288 command, | 293 command, |
289 command->isCompositeEditCommand(), | 294 command->isCompositeEditCommand(), |
290 command.isCompositeEditCommand()); | 295 command.isCompositeEditCommand()); |
291 | 296 |
292 } // namespace blink | 297 } // namespace blink |
293 | 298 |
294 #endif // CompositeEditCommand_h | 299 #endif // CompositeEditCommand_h |
OLD | NEW |