Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h |
| diff --git a/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h b/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f3e2be390719b04d39ccd77dfc15fe848bdec0fb |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +#ifndef SmoothScrollSequencer_h |
| +#define SmoothScrollSequencer_h |
| + |
| +#include <utility> |
| +#include <vector> |
| +#include "platform/heap/Handle.h" |
| +#include "platform/scroll/ScrollTypes.h" |
| + |
| +namespace blink { |
| + |
| +class ScrollableArea; |
| + |
| +// 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.
|
| +// so that they can be animated from outside to inside when smooth scroll |
| +// is called. |
| +class PLATFORM_EXPORT SmoothScrollSequencer |
| + : 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
|
| + public: |
| + static SmoothScrollSequencer* Create(); |
| + |
| + ~SmoothScrollSequencer(); |
| + |
| + // Add a scroll offset animation to the back of a queue. |
| + void QueueAnimation(ScrollableArea*, ScrollOffset); |
| + |
| + // Run the animation at the back of the queue. |
| + void RunQueuedAnimations(); |
| + |
| + // 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.
|
| + void AbortAnimations(); |
| + |
| + DECLARE_TRACE(); |
| + |
| + protected: |
| + SmoothScrollSequencer(); |
| + |
| + private: |
| + typedef std::pair<Member<ScrollableArea>, ScrollOffset> ScrollerAndOffsetPair; |
| + std::vector<ScrollerAndOffsetPair> queue_; |
| + Member<ScrollableArea> current_scrollable_; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // SmoothScrollSequencer_h |