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 10 matching lines...) Expand all Loading... | |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef EditCommand_h | 26 #ifndef EditCommand_h |
27 #define EditCommand_h | 27 #define EditCommand_h |
28 | 28 |
29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
30 #include "core/editing/VisibleSelection.h" | 30 #include "core/editing/VisibleSelection.h" |
31 #include "core/events/InputEvent.h" | |
32 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
33 | 32 |
34 namespace blink { | 33 namespace blink { |
35 | 34 |
36 class CompositeEditCommand; | 35 class CompositeEditCommand; |
37 class Document; | 36 class Document; |
38 class EditingState; | 37 class EditingState; |
39 | 38 |
40 class CORE_EXPORT EditCommand : public GarbageCollectedFinalized<EditCommand> { | 39 class CORE_EXPORT EditCommand : public GarbageCollectedFinalized<EditCommand> { |
41 public: | 40 public: |
42 virtual ~EditCommand(); | 41 virtual ~EditCommand(); |
43 | 42 |
44 void setParent(CompositeEditCommand*); | 43 void setParent(CompositeEditCommand*); |
45 | 44 |
46 virtual InputEvent::InputType inputType() const; | |
chongz
2016/12/20 23:27:53
Moved to |CompositeEditCommand::inputType()|.
| |
47 | |
48 const VisibleSelection& startingSelection() const { | 45 const VisibleSelection& startingSelection() const { |
49 return m_startingSelection; | 46 return m_startingSelection; |
50 } | 47 } |
51 const VisibleSelection& endingSelection() const { return m_endingSelection; } | 48 const VisibleSelection& endingSelection() const { return m_endingSelection; } |
52 | 49 |
53 virtual bool isSimpleEditCommand() const { return false; } | 50 virtual bool isSimpleEditCommand() const { return false; } |
54 virtual bool isCompositeEditCommand() const { return false; } | 51 virtual bool isCompositeEditCommand() const { return false; } |
55 bool isTopLevelCommand() const { return !m_parent; } | 52 bool isTopLevelCommand() const { return !m_parent; } |
56 | 53 |
57 // The |EditingState*| argument must not be nullptr. | 54 // The |EditingState*| argument must not be nullptr. |
58 virtual void doApply(EditingState*) = 0; | 55 virtual void doApply(EditingState*) = 0; |
59 | 56 |
60 // |TypingCommand| will return the text of the last |m_commands|. | |
61 virtual String textDataForInputEvent() const; | |
chongz
2016/12/20 23:27:52
Moved to |CompositeEditCommand::textDataForInputEv
| |
62 | |
63 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
64 | 58 |
65 protected: | 59 protected: |
66 explicit EditCommand(Document&); | 60 explicit EditCommand(Document&); |
67 | 61 |
68 Document& document() const { return *m_document.get(); } | 62 Document& document() const { return *m_document.get(); } |
69 CompositeEditCommand* parent() const { return m_parent; } | 63 CompositeEditCommand* parent() const { return m_parent; } |
70 void setStartingSelection(const VisibleSelection&); | 64 void setStartingSelection(const VisibleSelection&); |
71 void setEndingSelection(const SelectionInDOMTree&); | 65 void setEndingSelection(const SelectionInDOMTree&); |
72 // TODO(yosin): |setEndingVisibleSelection()| will take |SelectionInUndoStep| | 66 // TODO(yosin): |setEndingVisibleSelection()| will take |SelectionInUndoStep| |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 | 98 |
105 DEFINE_TYPE_CASTS(SimpleEditCommand, | 99 DEFINE_TYPE_CASTS(SimpleEditCommand, |
106 EditCommand, | 100 EditCommand, |
107 command, | 101 command, |
108 command->isSimpleEditCommand(), | 102 command->isSimpleEditCommand(), |
109 command.isSimpleEditCommand()); | 103 command.isSimpleEditCommand()); |
110 | 104 |
111 } // namespace blink | 105 } // namespace blink |
112 | 106 |
113 #endif // EditCommand_h | 107 #endif // EditCommand_h |
OLD | NEW |