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; | |
41 class LocalFrame; | 40 class LocalFrame; |
42 class UndoStep; | 41 class UndoStep; |
43 | 42 |
44 // |UndoStack| is owned by and always 1:1 to |Editor|. Since |Editor| is 1:1 to | 43 // |UndoStack| is owned by and always 1:1 to |Editor|. Since |Editor| is 1:1 to |
45 // |LocalFrame|, |UndoStack| is also 1:1 to |LocalFrame|. | 44 // |LocalFrame|, |UndoStack| is also 1:1 to |LocalFrame|. |
46 class UndoStack final : public GarbageCollected<UndoStack> { | 45 class UndoStack final : public GarbageCollected<UndoStack> { |
47 WTF_MAKE_NONCOPYABLE(UndoStack); | 46 WTF_MAKE_NONCOPYABLE(UndoStack); |
48 | 47 |
49 public: | 48 public: |
50 static UndoStack* create(); | 49 static UndoStack* create(); |
51 | 50 |
52 void registerUndoStep(UndoStep*); | 51 void registerUndoStep(UndoStep*); |
53 void registerRedoStep(UndoStep*); | 52 void registerRedoStep(UndoStep*); |
54 bool canUndo() const; | 53 bool canUndo() const; |
55 bool canRedo() const; | 54 bool canRedo() const; |
56 void undo(EditCommandSource); | 55 void undo(); |
57 void redo(EditCommandSource); | 56 void redo(); |
58 void clear(); | 57 void clear(); |
59 | 58 |
60 DECLARE_TRACE(); | 59 DECLARE_TRACE(); |
61 | 60 |
62 private: | 61 private: |
63 UndoStack(); | 62 UndoStack(); |
64 | 63 |
65 typedef HeapDeque<Member<UndoStep>> UndoStepStack; | 64 typedef HeapDeque<Member<UndoStep>> UndoStepStack; |
66 | 65 |
67 bool m_inRedo; | 66 bool m_inRedo; |
68 UndoStepStack m_undoStack; | 67 UndoStepStack m_undoStack; |
69 UndoStepStack m_redoStack; | 68 UndoStepStack m_redoStack; |
70 }; | 69 }; |
71 | 70 |
72 } // namespace blink | 71 } // namespace blink |
73 | 72 |
74 #endif | 73 #endif |
OLD | NEW |