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 #include "config.h" | 5 #include "config.h" |
6 #include "platform/scroll/ProgrammaticScrollAnimator.h" | 6 #include "platform/scroll/ProgrammaticScrollAnimator.h" |
7 | 7 |
8 #include "platform/geometry/IntPoint.h" | 8 #include "platform/geometry/IntPoint.h" |
9 #include "platform/scroll/ScrollableArea.h" | 9 #include "platform/scroll/ScrollableArea.h" |
10 #include "public/platform/Platform.h" | 10 #include "public/platform/Platform.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 void ProgrammaticScrollAnimator::resetAnimationState() | 31 void ProgrammaticScrollAnimator::resetAnimationState() |
32 { | 32 { |
33 m_animationCurve.clear(); | 33 m_animationCurve.clear(); |
34 m_startTime = 0.0; | 34 m_startTime = 0.0; |
35 } | 35 } |
36 | 36 |
37 void ProgrammaticScrollAnimator::animateToOffset(FloatPoint offset) | 37 void ProgrammaticScrollAnimator::animateToOffset(FloatPoint offset) |
38 { | 38 { |
39 m_startTime = 0.0; | 39 m_startTime = 0.0; |
40 m_targetOffset = offset; | 40 m_targetOffset = offset; |
41 m_animationCurve = adoptPtr(Platform::current()->compositorSupport()->create
ScrollOffsetAnimationCurve(m_targetOffset, WebAnimationCurve::TimingFunctionType
EaseInOut)); | 41 m_animationCurve = adoptPtr(Platform::current()->compositorSupport()->create
ScrollOffsetAnimationCurve(m_targetOffset, WebCompositorAnimationCurve::TimingFu
nctionTypeEaseInOut)); |
42 | 42 |
43 m_animationCurve->setInitialValue(FloatPoint(m_scrollableArea->scrollPositio
n())); | 43 m_animationCurve->setInitialValue(FloatPoint(m_scrollableArea->scrollPositio
n())); |
44 if (!m_scrollableArea->scheduleAnimation()) { | 44 if (!m_scrollableArea->scheduleAnimation()) { |
45 resetAnimationState(); | 45 resetAnimationState(); |
46 m_scrollableArea->notifyScrollPositionChanged(IntPoint(offset.x(), offse
t.y())); | 46 m_scrollableArea->notifyScrollPositionChanged(IntPoint(offset.x(), offse
t.y())); |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 void ProgrammaticScrollAnimator::cancelAnimation() | 50 void ProgrammaticScrollAnimator::cancelAnimation() |
51 { | 51 { |
(...skipping 13 matching lines...) Expand all Loading... |
65 if (isFinished) { | 65 if (isFinished) { |
66 resetAnimationState(); | 66 resetAnimationState(); |
67 } else if (!m_scrollableArea->scheduleAnimation()) { | 67 } else if (!m_scrollableArea->scheduleAnimation()) { |
68 m_scrollableArea->notifyScrollPositionChanged(IntPoint(m_targetOffse
t.x(), m_targetOffset.y())); | 68 m_scrollableArea->notifyScrollPositionChanged(IntPoint(m_targetOffse
t.x(), m_targetOffset.y())); |
69 resetAnimationState(); | 69 resetAnimationState(); |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 } // namespace blink | 74 } // namespace blink |
OLD | NEW |