| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 virtual EditAction editingAction() const override { return m_editAction; } | 48 virtual EditAction editingAction() const override { return m_editAction; } |
| 49 void append(SimpleEditCommand*); | 49 void append(SimpleEditCommand*); |
| 50 | 50 |
| 51 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } | 51 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } |
| 52 const VisibleSelection& endingSelection() const { return m_endingSelection;
} | 52 const VisibleSelection& endingSelection() const { return m_endingSelection;
} |
| 53 void setStartingSelection(const VisibleSelection&); | 53 void setStartingSelection(const VisibleSelection&); |
| 54 void setEndingSelection(const VisibleSelection&); | 54 void setEndingSelection(const VisibleSelection&); |
| 55 Element* startingRootEditableElement() const { return m_startingRootEditable
Element.get(); } | 55 Element* startingRootEditableElement() const { return m_startingRootEditable
Element.get(); } |
| 56 Element* endingRootEditableElement() const { return m_endingRootEditableElem
ent.get(); } | 56 Element* endingRootEditableElement() const { return m_endingRootEditableElem
ent.get(); } |
| 57 | 57 |
| 58 virtual void trace(Visitor*) override; | |
| 59 | |
| 60 private: | 58 private: |
| 61 EditCommandComposition(Document*, const VisibleSelection& startingSelection,
const VisibleSelection& endingSelection, EditAction); | 59 EditCommandComposition(Document*, const VisibleSelection& startingSelection,
const VisibleSelection& endingSelection, EditAction); |
| 62 | 60 |
| 63 RefPtr<Document> m_document; | 61 RefPtr<Document> m_document; |
| 64 VisibleSelection m_startingSelection; | 62 VisibleSelection m_startingSelection; |
| 65 VisibleSelection m_endingSelection; | 63 VisibleSelection m_endingSelection; |
| 66 Vector<RefPtr<SimpleEditCommand> > m_commands; | 64 Vector<RefPtr<SimpleEditCommand> > m_commands; |
| 67 RefPtr<Element> m_startingRootEditableElement; | 65 RefPtr<Element> m_startingRootEditableElement; |
| 68 RefPtr<Element> m_endingRootEditableElement; | 66 RefPtr<Element> m_endingRootEditableElement; |
| 69 EditAction m_editAction; | 67 EditAction m_editAction; |
| 70 }; | 68 }; |
| 71 | 69 |
| 72 class CompositeEditCommand : public EditCommand { | 70 class CompositeEditCommand : public EditCommand { |
| 73 public: | 71 public: |
| 74 virtual ~CompositeEditCommand(); | 72 virtual ~CompositeEditCommand(); |
| 75 | 73 |
| 76 void apply(); | 74 void apply(); |
| 77 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() &&
m_commands.first() == command; } | 75 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() &&
m_commands.first() == command; } |
| 78 EditCommandComposition* composition() { return m_composition.get(); } | 76 EditCommandComposition* composition() { return m_composition.get(); } |
| 79 EditCommandComposition* ensureComposition(); | 77 EditCommandComposition* ensureComposition(); |
| 80 | 78 |
| 81 virtual bool isTypingCommand() const; | 79 virtual bool isTypingCommand() const; |
| 82 virtual bool preservesTypingStyle() const; | 80 virtual bool preservesTypingStyle() const; |
| 83 virtual void setShouldRetainAutocorrectionIndicator(bool); | 81 virtual void setShouldRetainAutocorrectionIndicator(bool); |
| 84 virtual bool shouldStopCaretBlinking() const { return false; } | 82 virtual bool shouldStopCaretBlinking() const { return false; } |
| 85 | 83 |
| 86 virtual void trace(Visitor*) override; | |
| 87 | |
| 88 protected: | 84 protected: |
| 89 explicit CompositeEditCommand(Document&); | 85 explicit CompositeEditCommand(Document&); |
| 90 | 86 |
| 91 // | 87 // |
| 92 // sugary-sweet convenience functions to help create and apply edit commands
in composite commands | 88 // sugary-sweet convenience functions to help create and apply edit commands
in composite commands |
| 93 // | 89 // |
| 94 void appendNode(PassRefPtr<Node>, PassRefPtr<ContainerNode> parent); | 90 void appendNode(PassRefPtr<Node>, PassRefPtr<ContainerNode> parent); |
| 95 void applyCommandToComposite(PassRefPtr<EditCommand>); | 91 void applyCommandToComposite(PassRefPtr<EditCommand>); |
| 96 void applyCommandToComposite(PassRefPtr<CompositeEditCommand>, const Visible
Selection&); | 92 void applyCommandToComposite(PassRefPtr<CompositeEditCommand>, const Visible
Selection&); |
| 97 void removeStyledElement(PassRefPtr<Element>); | 93 void removeStyledElement(PassRefPtr<Element>); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 virtual bool isCompositeEditCommand() const override final { return true; } | 155 virtual bool isCompositeEditCommand() const override final { return true; } |
| 160 | 156 |
| 161 RefPtr<EditCommandComposition> m_composition; | 157 RefPtr<EditCommandComposition> m_composition; |
| 162 }; | 158 }; |
| 163 | 159 |
| 164 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi
teEditCommand(), command.isCompositeEditCommand()); | 160 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi
teEditCommand(), command.isCompositeEditCommand()); |
| 165 | 161 |
| 166 } // namespace blink | 162 } // namespace blink |
| 167 | 163 |
| 168 #endif // CompositeEditCommand_h | 164 #endif // CompositeEditCommand_h |
| OLD | NEW |