| 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 16 matching lines...) Expand all Loading... |
| 27 #define EditCommand_h | 27 #define EditCommand_h |
| 28 | 28 |
| 29 #include "core/editing/VisibleSelection.h" | 29 #include "core/editing/VisibleSelection.h" |
| 30 #include "core/editing/commands/EditAction.h" | 30 #include "core/editing/commands/EditAction.h" |
| 31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 class CompositeEditCommand; | 35 class CompositeEditCommand; |
| 36 class Document; | 36 class Document; |
| 37 class EditingState; |
| 37 | 38 |
| 38 class EditCommand : public RefCountedWillBeGarbageCollectedFinalized<EditCommand
> { | 39 class EditCommand : public RefCountedWillBeGarbageCollectedFinalized<EditCommand
> { |
| 39 public: | 40 public: |
| 40 virtual ~EditCommand(); | 41 virtual ~EditCommand(); |
| 41 | 42 |
| 42 void setParent(CompositeEditCommand*); | 43 void setParent(CompositeEditCommand*); |
| 43 | 44 |
| 44 virtual EditAction editingAction() const; | 45 virtual EditAction editingAction() const; |
| 45 | 46 |
| 46 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } | 47 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } |
| 47 const VisibleSelection& endingSelection() const { return m_endingSelection;
} | 48 const VisibleSelection& endingSelection() const { return m_endingSelection;
} |
| 48 | 49 |
| 49 virtual bool isSimpleEditCommand() const { return false; } | 50 virtual bool isSimpleEditCommand() const { return false; } |
| 50 virtual bool isCompositeEditCommand() const { return false; } | 51 virtual bool isCompositeEditCommand() const { return false; } |
| 51 bool isTopLevelCommand() const { return !m_parent; } | 52 bool isTopLevelCommand() const { return !m_parent; } |
| 52 | 53 |
| 53 virtual void doApply() = 0; | 54 // The |EditingState*| argument must not be nullptr. |
| 55 virtual void doApply(EditingState*) = 0; |
| 54 | 56 |
| 55 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
| 56 | 58 |
| 57 protected: | 59 protected: |
| 58 explicit EditCommand(Document&); | 60 explicit EditCommand(Document&); |
| 59 | 61 |
| 60 Document& document() const { return *m_document.get(); } | 62 Document& document() const { return *m_document.get(); } |
| 61 CompositeEditCommand* parent() const { return m_parent; } | 63 CompositeEditCommand* parent() const { return m_parent; } |
| 62 void setStartingSelection(const VisibleSelection&); | 64 void setStartingSelection(const VisibleSelection&); |
| 63 void setEndingSelection(const VisibleSelection&); | 65 void setEndingSelection(const VisibleSelection&); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 90 | 92 |
| 91 private: | 93 private: |
| 92 bool isSimpleEditCommand() const final { return true; } | 94 bool isSimpleEditCommand() const final { return true; } |
| 93 }; | 95 }; |
| 94 | 96 |
| 95 DEFINE_TYPE_CASTS(SimpleEditCommand, EditCommand, command, command->isSimpleEdit
Command(), command.isSimpleEditCommand()); | 97 DEFINE_TYPE_CASTS(SimpleEditCommand, EditCommand, command, command->isSimpleEdit
Command(), command.isSimpleEditCommand()); |
| 96 | 98 |
| 97 } // namespace blink | 99 } // namespace blink |
| 98 | 100 |
| 99 #endif // EditCommand_h | 101 #endif // EditCommand_h |
| OLD | NEW |