| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #define UndoStep_h | 32 #define UndoStep_h |
| 33 | 33 |
| 34 #include "core/editing/VisibleSelection.h" | 34 #include "core/editing/VisibleSelection.h" |
| 35 #include "core/events/InputEvent.h" | 35 #include "core/events/InputEvent.h" |
| 36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class SimpleEditCommand; | 40 class SimpleEditCommand; |
| 41 | 41 |
| 42 // TODO(xiaochengh): Rename this class to |UndoStep|. | 42 class UndoStep : public GarbageCollectedFinalized<UndoStep> { |
| 43 class EditCommandComposition | |
| 44 : public GarbageCollectedFinalized<EditCommandComposition> { | |
| 45 public: | 43 public: |
| 46 static EditCommandComposition* create(Document*, | 44 static UndoStep* create(Document*, |
| 47 const VisibleSelection&, | 45 const VisibleSelection&, |
| 48 const VisibleSelection&, | 46 const VisibleSelection&, |
| 49 InputEvent::InputType); | 47 InputEvent::InputType); |
| 50 | 48 |
| 51 void unapply(); | 49 void unapply(); |
| 52 void reapply(); | 50 void reapply(); |
| 53 InputEvent::InputType inputType() const; | 51 InputEvent::InputType inputType() const; |
| 54 void append(SimpleEditCommand*); | 52 void append(SimpleEditCommand*); |
| 55 void append(EditCommandComposition*); | 53 void append(UndoStep*); |
| 56 | 54 |
| 57 const VisibleSelection& startingSelection() const { | 55 const VisibleSelection& startingSelection() const { |
| 58 return m_startingSelection; | 56 return m_startingSelection; |
| 59 } | 57 } |
| 60 const VisibleSelection& endingSelection() const { return m_endingSelection; } | 58 const VisibleSelection& endingSelection() const { return m_endingSelection; } |
| 61 void setStartingSelection(const VisibleSelection&); | 59 void setStartingSelection(const VisibleSelection&); |
| 62 void setEndingSelection(const VisibleSelection&); | 60 void setEndingSelection(const VisibleSelection&); |
| 63 Element* startingRootEditableElement() const { | 61 Element* startingRootEditableElement() const { |
| 64 return m_startingRootEditableElement.get(); | 62 return m_startingRootEditableElement.get(); |
| 65 } | 63 } |
| 66 Element* endingRootEditableElement() const { | 64 Element* endingRootEditableElement() const { |
| 67 return m_endingRootEditableElement.get(); | 65 return m_endingRootEditableElement.get(); |
| 68 } | 66 } |
| 69 | 67 |
| 70 DECLARE_TRACE(); | 68 DECLARE_TRACE(); |
| 71 | 69 |
| 72 private: | 70 private: |
| 73 EditCommandComposition(Document*, | 71 UndoStep(Document*, |
| 74 const VisibleSelection& startingSelection, | 72 const VisibleSelection& startingSelection, |
| 75 const VisibleSelection& endingSelection, | 73 const VisibleSelection& endingSelection, |
| 76 InputEvent::InputType); | 74 InputEvent::InputType); |
| 77 | 75 |
| 78 Member<Document> m_document; | 76 Member<Document> m_document; |
| 79 VisibleSelection m_startingSelection; | 77 VisibleSelection m_startingSelection; |
| 80 VisibleSelection m_endingSelection; | 78 VisibleSelection m_endingSelection; |
| 81 HeapVector<Member<SimpleEditCommand>> m_commands; | 79 HeapVector<Member<SimpleEditCommand>> m_commands; |
| 82 Member<Element> m_startingRootEditableElement; | 80 Member<Element> m_startingRootEditableElement; |
| 83 Member<Element> m_endingRootEditableElement; | 81 Member<Element> m_endingRootEditableElement; |
| 84 InputEvent::InputType m_inputType; | 82 InputEvent::InputType m_inputType; |
| 85 }; | 83 }; |
| 86 | 84 |
| 87 } // namespace blink | 85 } // namespace blink |
| 88 | 86 |
| 89 #endif | 87 #endif |
| OLD | NEW |