| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ProgrammaticScrollAnimator_h | 5 #ifndef ProgrammaticScrollAnimator_h |
| 6 #define ProgrammaticScrollAnimator_h | 6 #define ProgrammaticScrollAnimator_h |
| 7 | 7 |
| 8 #include "platform/geometry/FloatPoint.h" | 8 #include "platform/geometry/FloatPoint.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" | 10 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" |
| 11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
| 12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
| 13 #include "wtf/OwnPtr.h" | 13 #include "wtf/OwnPtr.h" |
| 14 #include "wtf/PassOwnPtr.h" | 14 #include "wtf/PassOwnPtr.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class ScrollableArea; | 18 class ScrollableArea; |
| 19 class WebCompositorAnimationTimeline; | 19 class WebCompositorAnimationTimeline; |
| 20 class WebScrollOffsetAnimationCurve; | 20 class WebScrollOffsetAnimationCurve; |
| 21 | 21 |
| 22 // Animator for fixed-destination scrolls, such as those triggered by | 22 // Animator for fixed-destination scrolls, such as those triggered by |
| 23 // CSSOM View scroll APIs. | 23 // CSSOM View scroll APIs. |
| 24 class ProgrammaticScrollAnimator : public ScrollAnimatorCompositorCoordinator { | 24 class ProgrammaticScrollAnimator : public ScrollAnimatorCompositorCoordinator { |
| 25 WTF_MAKE_NONCOPYABLE(ProgrammaticScrollAnimator); | 25 WTF_MAKE_NONCOPYABLE(ProgrammaticScrollAnimator); |
| 26 USING_FAST_MALLOC_WILL_BE_REMOVED(ProgrammaticScrollAnimator); | |
| 27 public: | 26 public: |
| 28 static PassOwnPtrWillBeRawPtr<ProgrammaticScrollAnimator> create(ScrollableA
rea*); | 27 static RawPtr<ProgrammaticScrollAnimator> create(ScrollableArea*); |
| 29 | 28 |
| 30 virtual ~ProgrammaticScrollAnimator(); | 29 virtual ~ProgrammaticScrollAnimator(); |
| 31 | 30 |
| 32 void scrollToOffsetWithoutAnimation(const FloatPoint&); | 31 void scrollToOffsetWithoutAnimation(const FloatPoint&); |
| 33 void animateToOffset(FloatPoint); | 32 void animateToOffset(FloatPoint); |
| 34 | 33 |
| 35 // ScrollAnimatorCompositorCoordinator implementation. | 34 // ScrollAnimatorCompositorCoordinator implementation. |
| 36 void resetAnimationState() override; | 35 void resetAnimationState() override; |
| 37 void cancelAnimation() override; | 36 void cancelAnimation() override; |
| 38 ScrollableArea* scrollableArea() const override { return m_scrollableArea; } | 37 ScrollableArea* scrollableArea() const override { return m_scrollableArea; } |
| 39 void tickAnimation(double monotonicTime) override; | 38 void tickAnimation(double monotonicTime) override; |
| 40 void updateCompositorAnimations() override; | 39 void updateCompositorAnimations() override; |
| 41 void notifyCompositorAnimationFinished(int groupId) override; | 40 void notifyCompositorAnimationFinished(int groupId) override; |
| 42 void notifyCompositorAnimationAborted(int groupId) override { }; | 41 void notifyCompositorAnimationAborted(int groupId) override { }; |
| 43 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) o
verride; | 42 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) o
verride; |
| 44 | 43 |
| 45 DECLARE_TRACE(); | 44 DECLARE_TRACE(); |
| 46 | 45 |
| 47 private: | 46 private: |
| 48 explicit ProgrammaticScrollAnimator(ScrollableArea*); | 47 explicit ProgrammaticScrollAnimator(ScrollableArea*); |
| 49 | 48 |
| 50 void notifyPositionChanged(const DoublePoint&); | 49 void notifyPositionChanged(const DoublePoint&); |
| 51 | 50 |
| 52 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; | 51 Member<ScrollableArea> m_scrollableArea; |
| 53 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; | 52 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; |
| 54 FloatPoint m_targetOffset; | 53 FloatPoint m_targetOffset; |
| 55 double m_startTime; | 54 double m_startTime; |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 } // namespace blink | 57 } // namespace blink |
| 59 | 58 |
| 60 #endif // ProgrammaticScrollAnimator_h | 59 #endif // ProgrammaticScrollAnimator_h |
| OLD | NEW |