| 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "platform/scroll/ScrollAnimator.h" | 31 #include "platform/scroll/ScrollAnimator.h" |
| 32 | 32 |
| 33 #include "platform/CompositorFactory.h" |
| 33 #include "platform/TraceEvent.h" | 34 #include "platform/TraceEvent.h" |
| 34 #include "platform/graphics/GraphicsLayer.h" | 35 #include "platform/graphics/GraphicsLayer.h" |
| 35 #include "platform/scroll/ScrollableArea.h" | 36 #include "platform/scroll/ScrollableArea.h" |
| 36 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 37 #include "public/platform/WebCompositorAnimation.h" | 38 #include "public/platform/WebCompositorAnimation.h" |
| 38 #include "public/platform/WebCompositorSupport.h" | 39 #include "public/platform/WebCompositorSupport.h" |
| 39 #include "wtf/CurrentTime.h" | 40 #include "wtf/CurrentTime.h" |
| 40 #include "wtf/PassRefPtr.h" | 41 #include "wtf/PassRefPtr.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 218 |
| 218 m_compositorAnimationId = 0; | 219 m_compositorAnimationId = 0; |
| 219 m_compositorAnimationGroupId = 0; | 220 m_compositorAnimationGroupId = 0; |
| 220 | 221 |
| 221 m_animationCurve->updateTarget(m_timeFunction() - m_startTime, | 222 m_animationCurve->updateTarget(m_timeFunction() - m_startTime, |
| 222 m_targetOffset); | 223 m_targetOffset); |
| 223 m_runState = RunState::WaitingToSendToCompositor; | 224 m_runState = RunState::WaitingToSendToCompositor; |
| 224 } | 225 } |
| 225 | 226 |
| 226 if (!m_animationCurve) { | 227 if (!m_animationCurve) { |
| 227 m_animationCurve = adoptPtr(Platform::current()->compositorSupport() | 228 m_animationCurve = adoptPtr(CompositorFactory::current().createScrol
lOffsetAnimationCurve( |
| 228 ->createScrollOffsetAnimationCurve( | 229 m_targetOffset, |
| 229 m_targetOffset, | 230 WebCompositorAnimationCurve::TimingFunctionTypeEaseInOut, |
| 230 WebCompositorAnimationCurve::TimingFunctionTypeEaseInOut, | 231 m_lastGranularity == ScrollByPixel ? WebScrollOffsetAnimationCur
ve::ScrollDurationInverseDelta : WebScrollOffsetAnimationCurve::ScrollDurationCo
nstant)); |
| 231 m_lastGranularity == ScrollByPixel ? | |
| 232 WebScrollOffsetAnimationCurve::ScrollDurationInverseDelt
a : | |
| 233 WebScrollOffsetAnimationCurve::ScrollDurationConstant)); | |
| 234 m_animationCurve->setInitialValue(currentPosition()); | 232 m_animationCurve->setInitialValue(currentPosition()); |
| 235 } | 233 } |
| 236 | 234 |
| 237 bool sentToCompositor = false; | 235 bool sentToCompositor = false; |
| 238 if (GraphicsLayer* layer = m_scrollableArea->layerForScrolling()) { | 236 if (GraphicsLayer* layer = m_scrollableArea->layerForScrolling()) { |
| 239 ASSERT(layer->scrollableArea() == m_scrollableArea); | 237 ASSERT(layer->scrollableArea() == m_scrollableArea); |
| 240 if (!layer->platformLayer()->shouldScrollOnMainThread()) { | 238 if (!layer->platformLayer()->shouldScrollOnMainThread()) { |
| 241 OwnPtr<WebCompositorAnimation> animation = adoptPtr( | 239 OwnPtr<WebCompositorAnimation> animation = adoptPtr( |
| 242 Platform::current()->compositorSupport()->createAnimation( | 240 Platform::current()->compositorSupport()->createAnimation( |
| 243 *m_animationCurve, | 241 *m_animationCurve, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 300 } |
| 303 return true; | 301 return true; |
| 304 } | 302 } |
| 305 | 303 |
| 306 DEFINE_TRACE(ScrollAnimator) | 304 DEFINE_TRACE(ScrollAnimator) |
| 307 { | 305 { |
| 308 ScrollAnimatorBase::trace(visitor); | 306 ScrollAnimatorBase::trace(visitor); |
| 309 } | 307 } |
| 310 | 308 |
| 311 } // namespace blink | 309 } // namespace blink |
| OLD | NEW |