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 25 matching lines...) Expand all Loading... |
36 #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" | 36 #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" |
37 #include "platform/geometry/FloatPoint.h" | 37 #include "platform/geometry/FloatPoint.h" |
38 #include "platform/scroll/ScrollAnimatorBase.h" | 38 #include "platform/scroll/ScrollAnimatorBase.h" |
39 #include "public/platform/WebCompositorAnimationDelegate.h" | 39 #include "public/platform/WebCompositorAnimationDelegate.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class ScrollAnimatorTest; | 43 class ScrollAnimatorTest; |
44 class CompositorAnimationTimeline; | 44 class CompositorAnimationTimeline; |
45 | 45 |
46 class PLATFORM_EXPORT ScrollAnimator : public ScrollAnimatorBase { | 46 class PLATFORM_EXPORT ScrollAnimator final : public ScrollAnimatorBase { |
47 public: | 47 public: |
48 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); | 48 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); |
49 ~ScrollAnimator() override; | 49 ~ScrollAnimator() override; |
50 | 50 |
51 bool hasRunningAnimation() const override; | 51 bool hasRunningAnimation() const override; |
52 float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const ov
erride; | 52 float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const ov
erride; |
53 | 53 |
54 ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGranularit
y, float step, float delta) override; | 54 ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGranularit
y, float step, float delta) override; |
55 void scrollToOffsetWithoutAnimation(const FloatPoint&) override; | 55 void scrollToOffsetWithoutAnimation(const FloatPoint&) override; |
56 FloatPoint desiredTargetPosition() const override; | 56 FloatPoint desiredTargetPosition() const override; |
57 | 57 |
58 // ScrollAnimatorCompositorCoordinator implementation. | 58 // ScrollAnimatorCompositorCoordinator implementation. |
59 void tickAnimation(double monotonicTime) override; | 59 void tickAnimation(double monotonicTime) override; |
60 void cancelAnimation() override; | 60 void cancelAnimation() override; |
61 void takeoverCompositorAnimation() override; | |
62 void resetAnimationState() override; | 61 void resetAnimationState() override; |
63 void updateCompositorAnimations() override; | 62 void updateCompositorAnimations() override; |
64 void notifyCompositorAnimationFinished(int groupId) override; | 63 void notifyCompositorAnimationFinished(int groupId) override; |
65 void notifyCompositorAnimationAborted(int groupId) override; | 64 void notifyCompositorAnimationAborted(int groupId) override; |
66 void layerForCompositedScrollingDidChange(CompositorAnimationTimeline*) over
ride; | 65 void layerForCompositedScrollingDidChange(CompositorAnimationTimeline*) over
ride; |
67 | 66 |
68 DECLARE_VIRTUAL_TRACE(); | 67 DECLARE_VIRTUAL_TRACE(); |
69 | 68 |
70 protected: | 69 protected: |
71 // Returns whether or not the animation was sent to the compositor. | |
72 virtual bool sendAnimationToCompositor(); | |
73 | |
74 void notifyAnimationTakeover( | 70 void notifyAnimationTakeover( |
75 double monotonicTime, | 71 double monotonicTime, |
76 double animationStartTime, | 72 double animationStartTime, |
77 scoped_ptr<cc::AnimationCurve>) override; | 73 scoped_ptr<cc::AnimationCurve>) override; |
78 | 74 |
79 OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; | 75 OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; |
80 double m_startTime; | 76 double m_startTime; |
81 WTF::TimeFunction m_timeFunction; | 77 WTF::TimeFunction m_timeFunction; |
82 | 78 |
83 private: | 79 private: |
(...skipping 12 matching lines...) Expand all Loading... |
96 // because we are already at targetPos. | 92 // because we are already at targetPos. |
97 bool willAnimateToOffset(const FloatPoint& targetPos); | 93 bool willAnimateToOffset(const FloatPoint& targetPos); |
98 | 94 |
99 FloatPoint m_targetOffset; | 95 FloatPoint m_targetOffset; |
100 ScrollGranularity m_lastGranularity; | 96 ScrollGranularity m_lastGranularity; |
101 }; | 97 }; |
102 | 98 |
103 } // namespace blink | 99 } // namespace blink |
104 | 100 |
105 #endif // ScrollAnimator_h | 101 #endif // ScrollAnimator_h |
OLD | NEW |