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 "platform/heap/Handle.h" |
| 9 #include "platform/scroll/ScrollTypes.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class ScrollableArea; |
| 14 |
| 15 // A sequencer that queues the nested scrollers from inside to outside, |
| 16 // so that they can be animated from outside to inside when smooth scroll |
| 17 // is called. |
| 18 class PLATFORM_EXPORT SmoothScrollSequencer final |
| 19 : public GarbageCollected<SmoothScrollSequencer> { |
| 20 public: |
| 21 SmoothScrollSequencer(); |
| 22 // Add a scroll offset animation to the back of a queue. |
| 23 void QueueAnimation(ScrollableArea*, ScrollOffset); |
| 24 |
| 25 // Run the animation at the back of the queue. |
| 26 void RunQueuedAnimations(); |
| 27 |
| 28 // Abort the currently running animation and all the animations in the queue. |
| 29 void AbortAnimations(); |
| 30 |
| 31 DECLARE_TRACE(); |
| 32 |
| 33 private: |
| 34 typedef std::pair<Member<ScrollableArea>, ScrollOffset> ScrollerAndOffsetPair; |
| 35 HeapVector<ScrollerAndOffsetPair> queue_; |
| 36 Member<ScrollableArea> current_scrollable_; |
| 37 }; |
| 38 |
| 39 } // namespace blink |
| 40 |
| 41 #endif // SmoothScrollSequencer_h |
OLD | NEW |