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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 class EditCommandComposition final : public UndoStep { | 45 class EditCommandComposition final : public UndoStep { |
46 public: | 46 public: |
47 static EditCommandComposition* create(Document*, const VisibleSelection&, co
nst VisibleSelection&, InputEvent::InputType); | 47 static EditCommandComposition* create(Document*, const VisibleSelection&, co
nst VisibleSelection&, InputEvent::InputType); |
48 | 48 |
49 bool belongsTo(const LocalFrame&) const override; | 49 bool belongsTo(const LocalFrame&) const override; |
50 void unapply() override; | 50 void unapply() override; |
51 void reapply() override; | 51 void reapply() override; |
52 InputEvent::InputType inputType() const override; | 52 InputEvent::InputType inputType() const override; |
53 void append(SimpleEditCommand*); | 53 void append(SimpleEditCommand*); |
| 54 void append(EditCommandComposition*); |
54 | 55 |
55 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } | 56 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } |
56 const VisibleSelection& endingSelection() const { return m_endingSelection;
} | 57 const VisibleSelection& endingSelection() const { return m_endingSelection;
} |
57 void setStartingSelection(const VisibleSelection&); | 58 void setStartingSelection(const VisibleSelection&); |
58 void setEndingSelection(const VisibleSelection&); | 59 void setEndingSelection(const VisibleSelection&); |
59 Element* startingRootEditableElement() const { return m_startingRootEditable
Element.get(); } | 60 Element* startingRootEditableElement() const { return m_startingRootEditable
Element.get(); } |
60 Element* endingRootEditableElement() const { return m_endingRootEditableElem
ent.get(); } | 61 Element* endingRootEditableElement() const { return m_endingRootEditableElem
ent.get(); } |
61 | 62 |
62 DECLARE_VIRTUAL_TRACE(); | 63 DECLARE_VIRTUAL_TRACE(); |
63 | 64 |
(...skipping 14 matching lines...) Expand all Loading... |
78 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection }; | 79 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection }; |
79 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle }; | 80 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle }; |
80 | 81 |
81 ~CompositeEditCommand() override; | 82 ~CompositeEditCommand() override; |
82 | 83 |
83 // Returns |false| if the command failed. e.g. It's aborted. | 84 // Returns |false| if the command failed. e.g. It's aborted. |
84 bool apply(); | 85 bool apply(); |
85 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() &&
m_commands.first() == command; } | 86 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() &&
m_commands.first() == command; } |
86 EditCommandComposition* composition() { return m_composition.get(); } | 87 EditCommandComposition* composition() { return m_composition.get(); } |
87 EditCommandComposition* ensureComposition(); | 88 EditCommandComposition* ensureComposition(); |
| 89 // Append composition from an already applied command. |
| 90 void appendCommandToComposite(CompositeEditCommand*); |
88 | 91 |
89 virtual bool isReplaceSelectionCommand() const; | 92 virtual bool isReplaceSelectionCommand() const; |
90 virtual bool isTypingCommand() const; | 93 virtual bool isTypingCommand() const; |
91 virtual bool preservesTypingStyle() const; | 94 virtual bool preservesTypingStyle() const; |
92 virtual void setShouldRetainAutocorrectionIndicator(bool); | 95 virtual void setShouldRetainAutocorrectionIndicator(bool); |
93 virtual bool shouldStopCaretBlinking() const { return false; } | 96 virtual bool shouldStopCaretBlinking() const { return false; } |
94 | 97 |
95 DECLARE_VIRTUAL_TRACE(); | 98 DECLARE_VIRTUAL_TRACE(); |
96 | 99 |
97 protected: | 100 protected: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 bool isCompositeEditCommand() const final { return true; } | 182 bool isCompositeEditCommand() const final { return true; } |
180 | 183 |
181 Member<EditCommandComposition> m_composition; | 184 Member<EditCommandComposition> m_composition; |
182 }; | 185 }; |
183 | 186 |
184 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi
teEditCommand(), command.isCompositeEditCommand()); | 187 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi
teEditCommand(), command.isCompositeEditCommand()); |
185 | 188 |
186 } // namespace blink | 189 } // namespace blink |
187 | 190 |
188 #endif // CompositeEditCommand_h | 191 #endif // CompositeEditCommand_h |
OLD | NEW |