| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ScrollAnimator_h | 31 #ifndef ScrollAnimator_h |
| 32 #define ScrollAnimator_h | 32 #define ScrollAnimator_h |
| 33 | 33 |
| 34 #include "platform/Timer.h" | 34 #include "platform/Timer.h" |
| 35 #include "platform/geometry/FloatPoint.h" | 35 #include "platform/geometry/FloatPoint.h" |
| 36 #include "platform/scroll/ScrollAnimatorBase.h" | 36 #include "platform/scroll/ScrollAnimatorBase.h" |
| 37 #include "public/platform/WebCompositorAnimationDelegate.h" | |
| 38 #include "public/platform/WebCompositorAnimationPlayerClient.h" | |
| 39 #include "public/platform/WebScrollOffsetAnimationCurve.h" | 37 #include "public/platform/WebScrollOffsetAnimationCurve.h" |
| 40 | 38 |
| 41 namespace blink { | 39 namespace blink { |
| 42 | 40 |
| 43 class ScrollAnimatorTest; | 41 class ScrollAnimatorTest; |
| 44 class WebCompositorAnimationTimeline; | |
| 45 | 42 |
| 46 class PLATFORM_EXPORT ScrollAnimator final : public ScrollAnimatorBase { | 43 class PLATFORM_EXPORT ScrollAnimator final : public ScrollAnimatorBase { |
| 47 public: | 44 public: |
| 48 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); | 45 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); |
| 49 ~ScrollAnimator() override; | 46 ~ScrollAnimator() override; |
| 50 | 47 |
| 51 float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const ov
erride; | 48 float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const ov
erride; |
| 52 | 49 |
| 53 ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGranularit
y, float step, float delta) override; | 50 ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGranularit
y, float step, float delta) override; |
| 54 void scrollToOffsetWithoutAnimation(const FloatPoint&) override; | 51 void scrollToOffsetWithoutAnimation(const FloatPoint&) override; |
| 55 | 52 |
| 56 // ScrollAnimatorCompositorCoordinator implementation. | 53 void cancelAnimations() override; |
| 57 void tickAnimation(double monotonicTime) override; | 54 void serviceScrollAnimations() override; |
| 58 void cancelAnimation() override; | 55 bool hasRunningAnimation() const override; |
| 59 void resetAnimationState() override; | |
| 60 void updateCompositorAnimations() override; | |
| 61 void notifyCompositorAnimationFinished(int groupId) override; | |
| 62 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) o
verride; | |
| 63 | 56 |
| 64 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
| 65 | 58 |
| 66 protected: | 59 protected: |
| 60 void animationTimerFired(); |
| 61 |
| 67 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; | 62 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; |
| 68 double m_lastTickTime; | |
| 69 double m_startTime; | 63 double m_startTime; |
| 70 WTF::TimeFunction m_timeFunction; | 64 WTF::TimeFunction m_timeFunction; |
| 71 | |
| 72 private: | 65 private: |
| 73 FloatPoint desiredTargetPosition() const; | 66 FloatPoint desiredTargetPosition() const; |
| 74 | |
| 75 FloatPoint m_targetOffset; | |
| 76 }; | 67 }; |
| 77 | 68 |
| 78 } // namespace blink | 69 } // namespace blink |
| 79 | 70 |
| 80 #endif // ScrollAnimator_h | 71 #endif // ScrollAnimator_h |
| OLD | NEW |