| 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 19 matching lines...) Expand all Loading... |
| 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/animation/CompositorAnimationDelegate.h" | 35 #include "platform/animation/CompositorAnimationDelegate.h" |
| 36 #include "platform/animation/CompositorAnimationPlayerClient.h" | 36 #include "platform/animation/CompositorAnimationPlayerClient.h" |
| 37 #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" | 37 #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" |
| 38 #include "platform/geometry/FloatPoint.h" | 38 #include "platform/geometry/FloatPoint.h" |
| 39 #include "platform/scroll/ScrollAnimatorBase.h" | 39 #include "platform/scroll/ScrollAnimatorBase.h" |
| 40 #include <memory> | |
| 41 | 40 |
| 42 namespace blink { | 41 namespace blink { |
| 43 | 42 |
| 44 class ScrollAnimatorTest; | 43 class ScrollAnimatorTest; |
| 45 class CompositorAnimationTimeline; | 44 class CompositorAnimationTimeline; |
| 46 | 45 |
| 47 class PLATFORM_EXPORT ScrollAnimator : public ScrollAnimatorBase { | 46 class PLATFORM_EXPORT ScrollAnimator : public ScrollAnimatorBase { |
| 48 public: | 47 public: |
| 49 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); | 48 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); |
| 50 ~ScrollAnimator() override; | 49 ~ScrollAnimator() override; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 | 70 |
| 72 protected: | 71 protected: |
| 73 // Returns whether or not the animation was sent to the compositor. | 72 // Returns whether or not the animation was sent to the compositor. |
| 74 virtual bool sendAnimationToCompositor(); | 73 virtual bool sendAnimationToCompositor(); |
| 75 | 74 |
| 76 void notifyAnimationTakeover( | 75 void notifyAnimationTakeover( |
| 77 double monotonicTime, | 76 double monotonicTime, |
| 78 double animationStartTime, | 77 double animationStartTime, |
| 79 std::unique_ptr<cc::AnimationCurve>) override; | 78 std::unique_ptr<cc::AnimationCurve>) override; |
| 80 | 79 |
| 81 std::unique_ptr<CompositorScrollOffsetAnimationCurve> m_animationCurve; | 80 OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; |
| 82 double m_startTime; | 81 double m_startTime; |
| 83 WTF::TimeFunction m_timeFunction; | 82 WTF::TimeFunction m_timeFunction; |
| 84 | 83 |
| 85 private: | 84 private: |
| 86 // Returns true if the animation was scheduled successfully. If animation | 85 // Returns true if the animation was scheduled successfully. If animation |
| 87 // could not be scheduled (e.g. because the frame is detached), scrolls | 86 // could not be scheduled (e.g. because the frame is detached), scrolls |
| 88 // immediately to the target and returns false. | 87 // immediately to the target and returns false. |
| 89 bool registerAndScheduleAnimation(); | 88 bool registerAndScheduleAnimation(); |
| 90 | 89 |
| 91 void createAnimationCurve(); | 90 void createAnimationCurve(); |
| 92 void postAnimationCleanupAndReset(); | 91 void postAnimationCleanupAndReset(); |
| 93 | 92 |
| 94 void addMainThreadScrollingReason(); | 93 void addMainThreadScrollingReason(); |
| 95 void removeMainThreadScrollingReason(); | 94 void removeMainThreadScrollingReason(); |
| 96 | 95 |
| 97 // Returns true if will animate to the given target position. Returns false | 96 // Returns true if will animate to the given target position. Returns false |
| 98 // only when there is no animation running and we are not starting one | 97 // only when there is no animation running and we are not starting one |
| 99 // because we are already at targetPos. | 98 // because we are already at targetPos. |
| 100 bool willAnimateToOffset(const FloatPoint& targetPos); | 99 bool willAnimateToOffset(const FloatPoint& targetPos); |
| 101 | 100 |
| 102 FloatPoint m_targetOffset; | 101 FloatPoint m_targetOffset; |
| 103 ScrollGranularity m_lastGranularity; | 102 ScrollGranularity m_lastGranularity; |
| 104 }; | 103 }; |
| 105 | 104 |
| 106 } // namespace blink | 105 } // namespace blink |
| 107 | 106 |
| 108 #endif // ScrollAnimator_h | 107 #endif // ScrollAnimator_h |
| OLD | NEW |