OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 #ifndef SmoothScrollSequencer_h | |
5 #define SmoothScrollSequencer_h | |
6 | |
7 #include <utility> | |
8 #include <vector> | |
9 #include "platform/heap/Handle.h" | |
10 #include "platform/scroll/ScrollTypes.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class ScrollableArea; | |
15 | |
16 // A sequencer that queues the nested scrollers from inside to outside, | |
17 // so that they can be animated from outside to inside when smooth scroll | |
18 // is called. | |
19 class PLATFORM_EXPORT SmoothScrollSequencer | |
bokan
2017/05/19 18:37:14
lets mark this class as final
sunyunjia
2017/05/19 22:30:41
Done.
| |
20 : public GarbageCollectedFinalized<SmoothScrollSequencer> { | |
21 public: | |
22 static SmoothScrollSequencer* Create(); | |
23 | |
24 // Add a scroll offset animation to the back of a queue. | |
25 void QueueAnimation(ScrollableArea*, ScrollOffset); | |
26 | |
27 // Run the animation at the back of the queue. | |
28 void RunQueuedAnimations(); | |
29 | |
30 // Abort the currently running animation and all the animations in the queue. | |
31 void AbortAnimations(); | |
32 | |
33 DECLARE_TRACE(); | |
34 | |
35 protected: | |
36 SmoothScrollSequencer(); | |
37 | |
38 private: | |
39 typedef std::pair<Member<ScrollableArea>, ScrollOffset> ScrollerAndOffsetPair; | |
40 std::vector<ScrollerAndOffsetPair> queue_; | |
41 Member<ScrollableArea> current_scrollable_; | |
42 }; | |
43 | |
44 } // namespace blink | |
45 | |
46 #endif // SmoothScrollSequencer_h | |
OLD | NEW |