| 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 enum class EditCommandSource { kMenuOrKeyBinding, kDOM }; | 45 enum class EditCommandSource { kMenuOrKeyBinding, kDOM }; |
| 46 | 46 |
| 47 class CORE_EXPORT CompositeEditCommand : public EditCommand { | 47 class CORE_EXPORT CompositeEditCommand : public EditCommand { |
| 48 public: | 48 public: |
| 49 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection }; | 49 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection }; |
| 50 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle }; | 50 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle }; |
| 51 | 51 |
| 52 ~CompositeEditCommand() override; | 52 ~CompositeEditCommand() override; |
| 53 | 53 |
| 54 const VisibleSelection& startingSelection() const { |
| 55 return m_startingSelection; |
| 56 } |
| 57 const VisibleSelection& endingSelection() const { return m_endingSelection; } |
| 58 |
| 59 void setStartingSelection(const VisibleSelection&); |
| 60 void setEndingSelection(const SelectionInDOMTree&); |
| 61 // TODO(yosin): |setEndingVisibleSelection()| will take |SelectionInUndoStep| |
| 62 // You should not use this function other than copying existing selection. |
| 63 void setEndingVisibleSelection(const VisibleSelection&); |
| 64 |
| 65 void setParent(CompositeEditCommand*) override; |
| 66 |
| 54 // Returns |false| if the command failed. e.g. It's aborted. | 67 // Returns |false| if the command failed. e.g. It's aborted. |
| 55 bool apply(); | 68 bool apply(); |
| 56 bool isFirstCommand(EditCommand* command) { | 69 bool isFirstCommand(EditCommand* command) { |
| 57 return !m_commands.isEmpty() && m_commands.front() == command; | 70 return !m_commands.isEmpty() && m_commands.front() == command; |
| 58 } | 71 } |
| 59 UndoStep* undoStep() { return m_undoStep.get(); } | 72 UndoStep* undoStep() { return m_undoStep.get(); } |
| 60 UndoStep* ensureUndoStep(); | 73 UndoStep* ensureUndoStep(); |
| 61 // Append undo step from an already applied command. | 74 // Append undo step from an already applied command. |
| 62 void appendCommandToUndoStep(CompositeEditCommand*); | 75 void appendCommandToUndoStep(CompositeEditCommand*); |
| 63 | 76 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 Position positionAvoidingSpecialElementBoundary(const Position&, | 229 Position positionAvoidingSpecialElementBoundary(const Position&, |
| 217 EditingState*); | 230 EditingState*); |
| 218 | 231 |
| 219 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false); | 232 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false); |
| 220 | 233 |
| 221 HeapVector<Member<EditCommand>> m_commands; | 234 HeapVector<Member<EditCommand>> m_commands; |
| 222 | 235 |
| 223 private: | 236 private: |
| 224 bool isCompositeEditCommand() const final { return true; } | 237 bool isCompositeEditCommand() const final { return true; } |
| 225 | 238 |
| 239 VisibleSelection m_startingSelection; |
| 240 VisibleSelection m_endingSelection; |
| 226 Member<UndoStep> m_undoStep; | 241 Member<UndoStep> m_undoStep; |
| 227 }; | 242 }; |
| 228 | 243 |
| 229 DEFINE_TYPE_CASTS(CompositeEditCommand, | 244 DEFINE_TYPE_CASTS(CompositeEditCommand, |
| 230 EditCommand, | 245 EditCommand, |
| 231 command, | 246 command, |
| 232 command->isCompositeEditCommand(), | 247 command->isCompositeEditCommand(), |
| 233 command.isCompositeEditCommand()); | 248 command.isCompositeEditCommand()); |
| 234 | 249 |
| 235 } // namespace blink | 250 } // namespace blink |
| 236 | 251 |
| 237 #endif // CompositeEditCommand_h | 252 #endif // CompositeEditCommand_h |
| OLD | NEW |