OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 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 ProgrammaticScrollCoordinator_h |
| 5 #define ProgrammaticScrollCoordinator_h |
| 6 |
| 7 #include "platform/scroll/ProgrammaticScrollAnimatorClient.h" |
| 8 #include "platform/scroll/ScrollTypes.h" |
| 9 #include <utility> |
| 10 #include <vector> |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class ScrollableArea; |
| 15 |
| 16 class PLATFORM_EXPORT ProgrammaticScrollCoordinator |
| 17 : public ProgrammaticScrollAnimatorClient { |
| 18 public: |
| 19 static ProgrammaticScrollCoordinator* create(); |
| 20 |
| 21 ~ProgrammaticScrollCoordinator(); |
| 22 |
| 23 // Add a scroll offset animation to the back of a queue. |
| 24 void queueAnimation(ScrollableArea*, ScrollOffset); |
| 25 |
| 26 // Run the animation at the back of the queue and sets itself as a client |
| 27 // of ProgrammaticScrollAnimator to receive finish notification. |
| 28 void runQueuedAnimations(); |
| 29 |
| 30 // Pop the back of the queue and run the next animation in the queue. |
| 31 void notifyAnimationFinished(); |
| 32 |
| 33 // Abort the currently running anmation and all the animations in the queue. |
| 34 void abortAnimations(); |
| 35 |
| 36 protected: |
| 37 explicit ProgrammaticScrollCoordinator(); |
| 38 |
| 39 private: |
| 40 typedef std::pair<Member<ScrollableArea>, ScrollOffset> ScrollerAndOffsetPair; |
| 41 std::vector<ScrollerAndOffsetPair> m_queue; |
| 42 }; |
| 43 |
| 44 } // namespace blink |
| 45 |
| 46 #endif // ProgrammaticScrollCoordinator_h |
OLD | NEW |