| 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 // TODO(xiaochengh): Cleanup the names with term "composition". | |
| 48 class CORE_EXPORT CompositeEditCommand : public EditCommand { | 47 class CORE_EXPORT CompositeEditCommand : public EditCommand { |
| 49 public: | 48 public: |
| 50 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection }; | 49 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection }; |
| 51 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle }; | 50 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle }; |
| 52 | 51 |
| 53 ~CompositeEditCommand() override; | 52 ~CompositeEditCommand() override; |
| 54 | 53 |
| 55 // Returns |false| if the command failed. e.g. It's aborted. | 54 // Returns |false| if the command failed. e.g. It's aborted. |
| 56 bool apply(); | 55 bool apply(); |
| 57 bool isFirstCommand(EditCommand* command) { | 56 bool isFirstCommand(EditCommand* command) { |
| 58 return !m_commands.isEmpty() && m_commands.front() == command; | 57 return !m_commands.isEmpty() && m_commands.front() == command; |
| 59 } | 58 } |
| 60 UndoStep* composition() { return m_composition.get(); } | 59 UndoStep* undoStep() { return m_undoStep.get(); } |
| 61 UndoStep* ensureComposition(); | 60 UndoStep* ensureUndoStep(); |
| 62 // Append composition from an already applied command. | 61 // Append undo step from an already applied command. |
| 63 void appendCommandToComposite(CompositeEditCommand*); | 62 void appendCommandToUndoStep(CompositeEditCommand*); |
| 64 | 63 |
| 65 virtual bool isReplaceSelectionCommand() const; | 64 virtual bool isReplaceSelectionCommand() const; |
| 66 virtual bool isTypingCommand() const; | 65 virtual bool isTypingCommand() const; |
| 67 virtual bool isCommandGroupWrapper() const; | 66 virtual bool isCommandGroupWrapper() const; |
| 68 virtual bool isDragAndDropCommand() const; | 67 virtual bool isDragAndDropCommand() const; |
| 69 virtual bool preservesTypingStyle() const; | 68 virtual bool preservesTypingStyle() const; |
| 70 virtual void setShouldRetainAutocorrectionIndicator(bool); | 69 virtual void setShouldRetainAutocorrectionIndicator(bool); |
| 71 virtual bool shouldStopCaretBlinking() const { return false; } | 70 virtual bool shouldStopCaretBlinking() const { return false; } |
| 72 | 71 |
| 73 DECLARE_VIRTUAL_TRACE(); | 72 DECLARE_VIRTUAL_TRACE(); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 Position positionAvoidingSpecialElementBoundary(const Position&, | 216 Position positionAvoidingSpecialElementBoundary(const Position&, |
| 218 EditingState*); | 217 EditingState*); |
| 219 | 218 |
| 220 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false); | 219 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false); |
| 221 | 220 |
| 222 HeapVector<Member<EditCommand>> m_commands; | 221 HeapVector<Member<EditCommand>> m_commands; |
| 223 | 222 |
| 224 private: | 223 private: |
| 225 bool isCompositeEditCommand() const final { return true; } | 224 bool isCompositeEditCommand() const final { return true; } |
| 226 | 225 |
| 227 Member<UndoStep> m_composition; | 226 Member<UndoStep> m_undoStep; |
| 228 }; | 227 }; |
| 229 | 228 |
| 230 DEFINE_TYPE_CASTS(CompositeEditCommand, | 229 DEFINE_TYPE_CASTS(CompositeEditCommand, |
| 231 EditCommand, | 230 EditCommand, |
| 232 command, | 231 command, |
| 233 command->isCompositeEditCommand(), | 232 command->isCompositeEditCommand(), |
| 234 command.isCompositeEditCommand()); | 233 command.isCompositeEditCommand()); |
| 235 | 234 |
| 236 } // namespace blink | 235 } // namespace blink |
| 237 | 236 |
| 238 #endif // CompositeEditCommand_h | 237 #endif // CompositeEditCommand_h |
| OLD | NEW |