| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 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 CommandSource { MenuOrKeyBinding, Dom }; |
| 46 |
| 45 class EditCommandComposition final : public UndoStep { | 47 class EditCommandComposition final : public UndoStep { |
| 46 public: | 48 public: |
| 47 static EditCommandComposition* create(Document*, | 49 static EditCommandComposition* create(Document*, |
| 48 const VisibleSelection&, | 50 const VisibleSelection&, |
| 49 const VisibleSelection&, | 51 const VisibleSelection&, |
| 50 InputEvent::InputType); | 52 InputEvent::InputType); |
| 51 | 53 |
| 52 bool belongsTo(const LocalFrame&) const override; | 54 bool belongsTo(const LocalFrame&) const override; |
| 53 void unapply() override; | 55 void unapply() override; |
| 54 void reapply() override; | 56 void reapply() override; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 virtual bool isTypingCommand() const; | 109 virtual bool isTypingCommand() const; |
| 108 virtual bool isCommandGroupWrapper() const; | 110 virtual bool isCommandGroupWrapper() const; |
| 109 virtual bool isDragAndDropCommand() const; | 111 virtual bool isDragAndDropCommand() const; |
| 110 virtual bool preservesTypingStyle() const; | 112 virtual bool preservesTypingStyle() const; |
| 111 virtual void setShouldRetainAutocorrectionIndicator(bool); | 113 virtual void setShouldRetainAutocorrectionIndicator(bool); |
| 112 virtual bool shouldStopCaretBlinking() const { return false; } | 114 virtual bool shouldStopCaretBlinking() const { return false; } |
| 113 | 115 |
| 114 DECLARE_VIRTUAL_TRACE(); | 116 DECLARE_VIRTUAL_TRACE(); |
| 115 | 117 |
| 116 protected: | 118 protected: |
| 117 explicit CompositeEditCommand(Document&); | 119 CompositeEditCommand(Document&, CommandSource); |
| 118 | 120 |
| 119 // | 121 // |
| 120 // sugary-sweet convenience functions to help create and apply edit commands | 122 // sugary-sweet convenience functions to help create and apply edit commands |
| 121 // in composite commands | 123 // in composite commands |
| 122 // | 124 // |
| 123 void appendNode(Node*, ContainerNode* parent, EditingState*); | 125 void appendNode(Node*, ContainerNode* parent, EditingState*); |
| 124 void applyCommandToComposite(EditCommand*, EditingState*); | 126 void applyCommandToComposite(EditCommand*, EditingState*); |
| 125 void applyCommandToComposite(CompositeEditCommand*, | 127 void applyCommandToComposite(CompositeEditCommand*, |
| 126 const VisibleSelection&, | 128 const VisibleSelection&, |
| 127 EditingState*); | 129 EditingState*); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 VisiblePosition destination = VisiblePosition()); | 255 VisiblePosition destination = VisiblePosition()); |
| 254 | 256 |
| 255 bool breakOutOfEmptyListItem(EditingState*); | 257 bool breakOutOfEmptyListItem(EditingState*); |
| 256 bool breakOutOfEmptyMailBlockquotedParagraph(EditingState*); | 258 bool breakOutOfEmptyMailBlockquotedParagraph(EditingState*); |
| 257 | 259 |
| 258 Position positionAvoidingSpecialElementBoundary(const Position&, | 260 Position positionAvoidingSpecialElementBoundary(const Position&, |
| 259 EditingState*); | 261 EditingState*); |
| 260 | 262 |
| 261 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false); | 263 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false); |
| 262 | 264 |
| 265 CommandSource commandSource() const; |
| 266 |
| 263 HeapVector<Member<EditCommand>> m_commands; | 267 HeapVector<Member<EditCommand>> m_commands; |
| 264 | 268 |
| 265 private: | 269 private: |
| 266 bool isCompositeEditCommand() const final { return true; } | 270 bool isCompositeEditCommand() const final { return true; } |
| 267 | 271 |
| 268 Member<EditCommandComposition> m_composition; | 272 Member<EditCommandComposition> m_composition; |
| 273 CommandSource m_source; |
| 269 }; | 274 }; |
| 270 | 275 |
| 271 DEFINE_TYPE_CASTS(CompositeEditCommand, | 276 DEFINE_TYPE_CASTS(CompositeEditCommand, |
| 272 EditCommand, | 277 EditCommand, |
| 273 command, | 278 command, |
| 274 command->isCompositeEditCommand(), | 279 command->isCompositeEditCommand(), |
| 275 command.isCompositeEditCommand()); | 280 command.isCompositeEditCommand()); |
| 276 | 281 |
| 277 } // namespace blink | 282 } // namespace blink |
| 278 | 283 |
| 279 #endif // CompositeEditCommand_h | 284 #endif // CompositeEditCommand_h |
| OLD | NEW |