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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class PLATFORM_EXPORT ScrollAnimator final : 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; | 51 bool hasRunningAnimation() const; |
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 | 57 |
57 // ScrollAnimatorCompositorCoordinator implementation. | 58 // ScrollAnimatorCompositorCoordinator implementation. |
58 void tickAnimation(double monotonicTime) override; | 59 void tickAnimation(double monotonicTime) override; |
59 void cancelAnimation() override; | 60 void cancelAnimation() override; |
60 void resetAnimationState() override; | 61 void resetAnimationState() override; |
61 void updateCompositorAnimations() override; | 62 void updateCompositorAnimations() override; |
62 void notifyCompositorAnimationFinished(int groupId) override; | 63 void notifyCompositorAnimationFinished(int groupId) override; |
63 void notifyCompositorAnimationAborted(int groupId) override; | 64 void notifyCompositorAnimationAborted(int groupId) override; |
64 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) o
verride; | 65 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) o
verride; |
65 | 66 |
66 DECLARE_VIRTUAL_TRACE(); | 67 DECLARE_VIRTUAL_TRACE(); |
67 | 68 |
68 protected: | 69 protected: |
69 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; | 70 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; |
70 double m_startTime; | 71 double m_startTime; |
71 WTF::TimeFunction m_timeFunction; | 72 WTF::TimeFunction m_timeFunction; |
72 | 73 |
73 private: | 74 private: |
74 FloatPoint desiredTargetPosition() const; | |
75 | |
76 // Returns true if the animation was scheduled successfully. If animation | 75 // Returns true if the animation was scheduled successfully. If animation |
77 // could not be scheduled (e.g. because the frame is detached), scrolls | 76 // could not be scheduled (e.g. because the frame is detached), scrolls |
78 // immediately to the target and returns false. | 77 // immediately to the target and returns false. |
79 bool registerAndScheduleAnimation(); | 78 bool registerAndScheduleAnimation(); |
80 | 79 |
81 FloatPoint m_targetOffset; | 80 FloatPoint m_targetOffset; |
82 ScrollGranularity m_lastGranularity; | 81 ScrollGranularity m_lastGranularity; |
83 }; | 82 }; |
84 | 83 |
85 } // namespace blink | 84 } // namespace blink |
86 | 85 |
87 #endif // ScrollAnimator_h | 86 #endif // ScrollAnimator_h |
OLD | NEW |