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 stacks 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 |
| 20 : public GarbageCollectedFinalized<SmoothScrollSequencer> { |
| 21 public: |
| 22 static SmoothScrollSequencer* Create(); |
| 23 |
| 24 ~SmoothScrollSequencer(); |
| 25 |
| 26 // Add a scroll offset animation to the back of a queue. |
| 27 void QueueAnimation(ScrollableArea*, ScrollOffset); |
| 28 |
| 29 // Run the animation at the back of the queue. |
| 30 void RunQueuedAnimations(); |
| 31 |
| 32 // Abort the currently running anmation and all the animations in the queue. |
| 33 void AbortAnimations(); |
| 34 |
| 35 DECLARE_TRACE(); |
| 36 |
| 37 protected: |
| 38 SmoothScrollSequencer(); |
| 39 |
| 40 private: |
| 41 typedef std::pair<Member<ScrollableArea>, ScrollOffset> ScrollerAndOffsetPair; |
| 42 std::vector<ScrollerAndOffsetPair> queue_; |
| 43 Member<ScrollableArea> current_scrollable_; |
| 44 }; |
| 45 |
| 46 } // namespace blink |
| 47 |
| 48 #endif // SmoothScrollSequencer_h |
OLD | NEW |