Chromium Code Reviews| 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, | |
|
bokan
2017/05/15 17:15:28
s/stacks/queues
sunyunjia
2017/05/19 16:24:29
Done.
| |
| 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> { | |
|
bokan
2017/05/15 17:15:28
This class doesn't require finalization so it shou
sunyunjia
2017/05/19 16:24:29
I'm not very familiar with Oilpan management, but
bokan
2017/05/19 18:37:14
Ah, we should be using HeapVector instead since we
| |
| 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. | |
|
bokan
2017/05/15 17:15:28
nit: typo: anmation
sunyunjia
2017/05/19 16:24:29
Done.
| |
| 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 |