| Index: third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
|
| diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
|
| index abb8afc4a0ad883e6ca94dc1aff4bbab7837210e..93cda39222b8a56a8c6aa202eaabd58e83059815 100644
|
| --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
|
| +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
|
| @@ -145,18 +145,18 @@
|
| m_targetOffset = targetPos;
|
| ASSERT(m_runState == RunState::RunningOnMainThread
|
| || m_runState == RunState::RunningOnCompositor
|
| - || m_runState == RunState::RunningOnCompositorButNeedsUpdate
|
| - || m_runState == RunState::RunningOnCompositorButNeedsTakeover);
|
| + || m_runState == RunState::RunningOnCompositorButNeedsUpdate);
|
| +
|
| + if (m_runState == RunState::RunningOnCompositor
|
| + || m_runState == RunState::RunningOnCompositorButNeedsUpdate) {
|
| + if (registerAndScheduleAnimation())
|
| + m_runState = RunState::RunningOnCompositorButNeedsUpdate;
|
| + return true;
|
| + }
|
|
|
| // Running on the main thread, simply update the target offset instead
|
| // of sending to the compositor.
|
| - if (m_runState == RunState::RunningOnMainThread) {
|
| - m_animationCurve->updateTarget(m_timeFunction() - m_startTime, targetPos);
|
| - return true;
|
| - }
|
| -
|
| - if (registerAndScheduleAnimation())
|
| - m_runState = RunState::RunningOnCompositorButNeedsUpdate;
|
| + m_animationCurve->updateTarget(m_timeFunction() - m_startTime, targetPos);
|
| return true;
|
| }
|
|
|
| @@ -214,36 +214,6 @@
|
| removeMainThreadScrollingReason();
|
|
|
| resetAnimationState();
|
| -}
|
| -
|
| -bool ScrollAnimator::sendAnimationToCompositor()
|
| -{
|
| - if (m_scrollableArea->shouldScrollOnMainThread())
|
| - return false;
|
| -
|
| - OwnPtr<CompositorAnimation> animation = adoptPtr(
|
| - CompositorFactory::current().createAnimation(
|
| - *m_animationCurve,
|
| - CompositorTargetProperty::SCROLL_OFFSET));
|
| - // Being here means that either there is an animation that needs
|
| - // to be sent to the compositor, or an animation that needs to
|
| - // be updated (a new scroll event before the previous animation
|
| - // is finished). In either case, the start time is when the
|
| - // first animation was initiated. This re-targets the animation
|
| - // using the current time on main thread.
|
| - animation->setStartTime(m_startTime);
|
| -
|
| - int animationId = animation->id();
|
| - int animationGroupId = animation->group();
|
| -
|
| - bool sentToCompositor = addAnimation(animation.release());
|
| - if (sentToCompositor) {
|
| - m_runState = RunState::RunningOnCompositor;
|
| - m_compositorAnimationId = animationId;
|
| - m_compositorAnimationGroupId = animationGroupId;
|
| - }
|
| -
|
| - return sentToCompositor;
|
| }
|
|
|
| void ScrollAnimator::updateCompositorAnimations()
|
| @@ -260,16 +230,9 @@
|
| // compositor animation that needs to be removed here before the new
|
| // animation is added below.
|
| ASSERT(m_runState == RunState::WaitingToCancelOnCompositor
|
| - || m_runState == RunState::WaitingToSendToCompositor
|
| - || m_runState == RunState::RunningOnCompositorButNeedsTakeover);
|
| -
|
| - if (m_runState == RunState::RunningOnCompositorButNeedsTakeover) {
|
| - // The animation is already aborted when the call to
|
| - // ::takeoverCompositorAnimation is made.
|
| - m_runState = RunState::WaitingToSendToCompositor;
|
| - } else {
|
| - abortAnimation();
|
| - }
|
| + || m_runState == RunState::WaitingToSendToCompositor);
|
| +
|
| + abortAnimation();
|
|
|
| m_compositorAnimationId = 0;
|
| m_compositorAnimationGroupId = 0;
|
| @@ -304,8 +267,32 @@
|
| m_animationCurve->setInitialValue(currentPosition());
|
| }
|
|
|
| + bool sentToCompositor = false;
|
| + if (!m_scrollableArea->shouldScrollOnMainThread()) {
|
| + OwnPtr<CompositorAnimation> animation = adoptPtr(
|
| + CompositorFactory::current().createAnimation(
|
| + *m_animationCurve,
|
| + CompositorTargetProperty::SCROLL_OFFSET));
|
| + // Being here means that either there is an animation that needs
|
| + // to be sent to the compositor, or an animation that needs to
|
| + // be updated (a new scroll event before the previous animation
|
| + // is finished). In either case, the start time is when the
|
| + // first animation was initiated. This re-targets the animation
|
| + // using the current time on main thread.
|
| + animation->setStartTime(m_startTime);
|
| +
|
| + int animationId = animation->id();
|
| + int animationGroupId = animation->group();
|
| +
|
| + sentToCompositor = addAnimation(animation.release());
|
| + if (sentToCompositor) {
|
| + m_runState = RunState::RunningOnCompositor;
|
| + m_compositorAnimationId = animationId;
|
| + m_compositorAnimationGroupId = animationGroupId;
|
| + }
|
| + }
|
| +
|
| bool runningOnMainThread = false;
|
| - bool sentToCompositor = sendAnimationToCompositor();
|
| if (!sentToCompositor) {
|
| runningOnMainThread = registerAndScheduleAnimation();
|
| if (runningOnMainThread)
|
| @@ -375,15 +362,6 @@
|
| ScrollAnimatorCompositorCoordinator::cancelAnimation();
|
| }
|
|
|
| -void ScrollAnimator::takeoverCompositorAnimation()
|
| -{
|
| - if (m_runState == RunState::RunningOnCompositor
|
| - || m_runState == RunState::RunningOnCompositorButNeedsUpdate)
|
| - removeMainThreadScrollingReason();
|
| -
|
| - ScrollAnimatorCompositorCoordinator::takeoverCompositorAnimation();
|
| -}
|
| -
|
| void ScrollAnimator::layerForCompositedScrollingDidChange(
|
| CompositorAnimationTimeline* timeline)
|
| {
|
|
|