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