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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 enum class EditCommandSource { kMenuOrKeyBinding, kDOM }; | 45 enum class EditCommandSource { kMenuOrKeyBinding, kDOM }; |
46 | 46 |
47 class EditCommandComposition final : public UndoStep { | 47 class EditCommandComposition final : public UndoStep { |
48 public: | 48 public: |
49 static EditCommandComposition* create(Document*, | 49 static EditCommandComposition* create(Document*, |
50 const VisibleSelection&, | 50 const VisibleSelection&, |
51 const VisibleSelection&, | 51 const VisibleSelection&, |
52 InputEvent::InputType); | 52 InputEvent::InputType); |
53 | 53 |
54 bool belongsTo(const LocalFrame&) const override; | 54 bool belongsTo(const LocalFrame&) const override; |
55 void unapply() override; | 55 void unapply(EditCommandSource) override; |
56 void reapply() override; | 56 void reapply(EditCommandSource) override; |
57 InputEvent::InputType inputType() const override; | 57 InputEvent::InputType inputType() const override; |
58 void append(SimpleEditCommand*); | 58 void append(SimpleEditCommand*); |
59 void append(EditCommandComposition*); | 59 void append(EditCommandComposition*); |
60 | 60 |
61 const VisibleSelection& startingSelection() const { | 61 const VisibleSelection& startingSelection() const { |
62 return m_startingSelection; | 62 return m_startingSelection; |
63 } | 63 } |
64 const VisibleSelection& endingSelection() const { return m_endingSelection; } | 64 const VisibleSelection& endingSelection() const { return m_endingSelection; } |
65 void setStartingSelection(const VisibleSelection&); | 65 void setStartingSelection(const VisibleSelection&); |
66 void setEndingSelection(const VisibleSelection&); | 66 void setEndingSelection(const VisibleSelection&); |
67 Element* startingRootEditableElement() const { | 67 Element* startingRootEditableElement() const { |
68 return m_startingRootEditableElement.get(); | 68 return m_startingRootEditableElement.get(); |
69 } | 69 } |
70 Element* endingRootEditableElement() const { | 70 Element* endingRootEditableElement() const { |
71 return m_endingRootEditableElement.get(); | 71 return m_endingRootEditableElement.get(); |
72 } | 72 } |
73 | 73 |
74 DECLARE_VIRTUAL_TRACE(); | 74 DECLARE_VIRTUAL_TRACE(); |
75 | 75 |
76 private: | 76 private: |
77 EditCommandComposition(Document*, | 77 EditCommandComposition(Document*, |
78 const VisibleSelection& startingSelection, | 78 const VisibleSelection& startingSelection, |
79 const VisibleSelection& endingSelection, | 79 const VisibleSelection& endingSelection, |
80 InputEvent::InputType); | 80 InputEvent::InputType); |
81 | 81 |
82 // Fires "beforeinput". Returns |false| to cancel unapply / reapply when | |
Xiaocheng
2016/12/19 03:43:00
Please add a "TODO: implementation" note that the
chongz
2016/12/19 20:56:24
Done.
| |
83 // * "beforeinput" was canceled, or | |
84 // * |frame| was destroyed by event handlers. | |
85 // Note: Undo stack will always get popped. | |
86 bool willUnapply(EditCommandSource); | |
87 bool willReapply(EditCommandSource); | |
88 | |
82 Member<Document> m_document; | 89 Member<Document> m_document; |
83 VisibleSelection m_startingSelection; | 90 VisibleSelection m_startingSelection; |
84 VisibleSelection m_endingSelection; | 91 VisibleSelection m_endingSelection; |
85 HeapVector<Member<SimpleEditCommand>> m_commands; | 92 HeapVector<Member<SimpleEditCommand>> m_commands; |
86 Member<Element> m_startingRootEditableElement; | 93 Member<Element> m_startingRootEditableElement; |
87 Member<Element> m_endingRootEditableElement; | 94 Member<Element> m_endingRootEditableElement; |
88 InputEvent::InputType m_inputType; | 95 InputEvent::InputType m_inputType; |
89 }; | 96 }; |
90 | 97 |
91 class CORE_EXPORT CompositeEditCommand : public EditCommand { | 98 class CORE_EXPORT CompositeEditCommand : public EditCommand { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 | 290 |
284 DEFINE_TYPE_CASTS(CompositeEditCommand, | 291 DEFINE_TYPE_CASTS(CompositeEditCommand, |
285 EditCommand, | 292 EditCommand, |
286 command, | 293 command, |
287 command->isCompositeEditCommand(), | 294 command->isCompositeEditCommand(), |
288 command.isCompositeEditCommand()); | 295 command.isCompositeEditCommand()); |
289 | 296 |
290 } // namespace blink | 297 } // namespace blink |
291 | 298 |
292 #endif // CompositeEditCommand_h | 299 #endif // CompositeEditCommand_h |
OLD | NEW |