| 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class EditingStyle; | 38 class EditingStyle; |
| 39 class Element; | 39 class Element; |
| 40 class HTMLBRElement; | 40 class HTMLBRElement; |
| 41 class HTMLElement; | 41 class HTMLElement; |
| 42 class HTMLSpanElement; | 42 class HTMLSpanElement; |
| 43 class Text; | 43 class Text; |
| 44 | 44 |
| 45 enum class EditCommandSource { kMenuOrKeyBinding, kDOM }; | 45 enum class EditCommandSource { kMenuOrKeyBinding, kDOM }; |
| 46 | 46 |
| 47 class EditCommandComposition final : public UndoStep { | |
| 48 public: | |
| 49 static EditCommandComposition* create(Document*, | |
| 50 const VisibleSelection&, | |
| 51 const VisibleSelection&, | |
| 52 InputEvent::InputType); | |
| 53 | |
| 54 void unapply() override; | |
| 55 void reapply() override; | |
| 56 InputEvent::InputType inputType() const override; | |
| 57 void append(SimpleEditCommand*); | |
| 58 void append(EditCommandComposition*); | |
| 59 | |
| 60 const VisibleSelection& startingSelection() const { | |
| 61 return m_startingSelection; | |
| 62 } | |
| 63 const VisibleSelection& endingSelection() const { return m_endingSelection; } | |
| 64 void setStartingSelection(const VisibleSelection&); | |
| 65 void setEndingSelection(const VisibleSelection&); | |
| 66 Element* startingRootEditableElement() const { | |
| 67 return m_startingRootEditableElement.get(); | |
| 68 } | |
| 69 Element* endingRootEditableElement() const { | |
| 70 return m_endingRootEditableElement.get(); | |
| 71 } | |
| 72 | |
| 73 DECLARE_VIRTUAL_TRACE(); | |
| 74 | |
| 75 private: | |
| 76 EditCommandComposition(Document*, | |
| 77 const VisibleSelection& startingSelection, | |
| 78 const VisibleSelection& endingSelection, | |
| 79 InputEvent::InputType); | |
| 80 | |
| 81 Member<Document> m_document; | |
| 82 VisibleSelection m_startingSelection; | |
| 83 VisibleSelection m_endingSelection; | |
| 84 HeapVector<Member<SimpleEditCommand>> m_commands; | |
| 85 Member<Element> m_startingRootEditableElement; | |
| 86 Member<Element> m_endingRootEditableElement; | |
| 87 InputEvent::InputType m_inputType; | |
| 88 }; | |
| 89 | |
| 90 class CORE_EXPORT CompositeEditCommand : public EditCommand { | 47 class CORE_EXPORT CompositeEditCommand : public EditCommand { |
| 91 public: | 48 public: |
| 92 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection }; | 49 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection }; |
| 93 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle }; | 50 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle }; |
| 94 | 51 |
| 95 ~CompositeEditCommand() override; | 52 ~CompositeEditCommand() override; |
| 96 | 53 |
| 97 // Returns |false| if the command failed. e.g. It's aborted. | 54 // Returns |false| if the command failed. e.g. It's aborted. |
| 98 bool apply(); | 55 bool apply(); |
| 99 bool isFirstCommand(EditCommand* command) { | 56 bool isFirstCommand(EditCommand* command) { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 228 |
| 272 DEFINE_TYPE_CASTS(CompositeEditCommand, | 229 DEFINE_TYPE_CASTS(CompositeEditCommand, |
| 273 EditCommand, | 230 EditCommand, |
| 274 command, | 231 command, |
| 275 command->isCompositeEditCommand(), | 232 command->isCompositeEditCommand(), |
| 276 command.isCompositeEditCommand()); | 233 command.isCompositeEditCommand()); |
| 277 | 234 |
| 278 } // namespace blink | 235 } // namespace blink |
| 279 | 236 |
| 280 #endif // CompositeEditCommand_h | 237 #endif // CompositeEditCommand_h |
| OLD | NEW |