OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef UndoStack_h | 31 #ifndef UndoStack_h |
32 #define UndoStack_h | 32 #define UndoStack_h |
33 | 33 |
34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
35 #include "wtf/Deque.h" | 35 #include "wtf/Deque.h" |
36 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
| 40 enum class EditCommandSource; |
40 class LocalFrame; | 41 class LocalFrame; |
41 class UndoStep; | 42 class UndoStep; |
42 | 43 |
43 // |UndoStack| is owned by and always 1:1 to |Editor|. Since |Editor| is 1:1 to | 44 // |UndoStack| is owned by and always 1:1 to |Editor|. Since |Editor| is 1:1 to |
44 // |LocalFrame|, |UndoStack| is also 1:1 to |LocalFrame|. | 45 // |LocalFrame|, |UndoStack| is also 1:1 to |LocalFrame|. |
45 class UndoStack final : public GarbageCollected<UndoStack> { | 46 class UndoStack final : public GarbageCollected<UndoStack> { |
46 WTF_MAKE_NONCOPYABLE(UndoStack); | 47 WTF_MAKE_NONCOPYABLE(UndoStack); |
47 | 48 |
48 public: | 49 public: |
49 static UndoStack* create(); | 50 static UndoStack* create(); |
50 | 51 |
51 void registerUndoStep(UndoStep*); | 52 void registerUndoStep(UndoStep*); |
52 void registerRedoStep(UndoStep*); | 53 void registerRedoStep(UndoStep*); |
53 bool canUndo() const; | 54 bool canUndo() const; |
54 bool canRedo() const; | 55 bool canRedo() const; |
55 void undo(); | 56 void undo(EditCommandSource); |
56 void redo(); | 57 void redo(EditCommandSource); |
57 void clear(); | 58 void clear(); |
58 | 59 |
59 DECLARE_TRACE(); | 60 DECLARE_TRACE(); |
60 | 61 |
61 private: | 62 private: |
62 UndoStack(); | 63 UndoStack(); |
63 | 64 |
64 typedef HeapDeque<Member<UndoStep>> UndoStepStack; | 65 typedef HeapDeque<Member<UndoStep>> UndoStepStack; |
65 | 66 |
66 bool m_inRedo; | 67 bool m_inRedo; |
67 UndoStepStack m_undoStack; | 68 UndoStepStack m_undoStack; |
68 UndoStepStack m_redoStack; | 69 UndoStepStack m_redoStack; |
69 }; | 70 }; |
70 | 71 |
71 } // namespace blink | 72 } // namespace blink |
72 | 73 |
73 #endif | 74 #endif |
OLD | NEW |