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 22 matching lines...) Expand all Loading... | |
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 class LocalFrame; | 40 class LocalFrame; |
41 class UndoStep; | 41 class UndoStep; |
42 | 42 |
43 typedef HeapDeque<Member<UndoStep>> UndoStepStack; | |
yosin_UTC9
2017/03/02 03:38:40
nit: using UndoStepStack = HeapDeque<Member<UndoSt
| |
44 | |
43 // |UndoStack| is owned by and always 1:1 to |Editor|. Since |Editor| is 1:1 to | 45 // |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|. | 46 // |LocalFrame|, |UndoStack| is also 1:1 to |LocalFrame|. |
45 class UndoStack final : public GarbageCollected<UndoStack> { | 47 class UndoStack final : public GarbageCollected<UndoStack> { |
46 WTF_MAKE_NONCOPYABLE(UndoStack); | 48 WTF_MAKE_NONCOPYABLE(UndoStack); |
47 | 49 |
48 public: | 50 public: |
49 static UndoStack* create(); | 51 static UndoStack* create(); |
50 | 52 |
51 void registerUndoStep(UndoStep*); | 53 void registerUndoStep(UndoStep*); |
52 void registerRedoStep(UndoStep*); | 54 void registerRedoStep(UndoStep*); |
53 bool canUndo() const; | 55 bool canUndo() const; |
54 bool canRedo() const; | 56 bool canRedo() const; |
55 void undo(); | 57 void undo(); |
56 void redo(); | 58 void redo(); |
57 void clear(); | 59 void clear(); |
58 | 60 |
61 const UndoStepStack& undoSteps() const { return m_undoStack; } | |
yosin_UTC9
2017/03/02 03:38:40
Please provide high level API for usage base. We d
Xiaocheng
2017/03/02 04:34:59
Will do.
| |
62 | |
59 DECLARE_TRACE(); | 63 DECLARE_TRACE(); |
60 | 64 |
61 private: | 65 private: |
62 UndoStack(); | 66 UndoStack(); |
63 | 67 |
64 typedef HeapDeque<Member<UndoStep>> UndoStepStack; | |
65 | |
66 bool m_inRedo; | 68 bool m_inRedo; |
67 UndoStepStack m_undoStack; | 69 UndoStepStack m_undoStack; |
68 UndoStepStack m_redoStack; | 70 UndoStepStack m_redoStack; |
69 }; | 71 }; |
70 | 72 |
71 } // namespace blink | 73 } // namespace blink |
72 | 74 |
73 #endif | 75 #endif |
OLD | NEW |