| Index: Source/platform/scroll/ProgrammaticScrollAnimator.cpp
|
| diff --git a/Source/platform/scroll/ProgrammaticScrollAnimator.cpp b/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
|
| index b90293681fd23d6067da66203133efd13bf38794..3ef7aa3136b0e97a1b2ba497b2058e017d2affa2 100644
|
| --- a/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
|
| +++ b/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
|
| @@ -30,19 +30,14 @@ ProgrammaticScrollAnimator::ProgrammaticScrollAnimator(ScrollableArea* scrollabl
|
| , m_compositorAnimationId(0)
|
| , m_compositorAnimationGroupId(0)
|
| {
|
| - if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platform::current()->compositorSupport()) {
|
| - m_compositorPlayer = adoptPtr(Platform::current()->compositorSupport()->createAnimationPlayer());
|
| - ASSERT(m_compositorPlayer);
|
| - m_compositorPlayer->setAnimationDelegate(this);
|
| - }
|
| + m_compositorPlayer = adoptPtr(Platform::current()->compositorSupport()->createAnimationPlayer());
|
| + ASSERT(m_compositorPlayer);
|
| + m_compositorPlayer->setAnimationDelegate(this);
|
| }
|
|
|
| ProgrammaticScrollAnimator::~ProgrammaticScrollAnimator()
|
| {
|
| - if (m_compositorPlayer) {
|
| - m_compositorPlayer->setAnimationDelegate(nullptr);
|
| - m_compositorPlayer.clear();
|
| - }
|
| + m_compositorPlayer->setAnimationDelegate(nullptr);
|
| }
|
|
|
| void ProgrammaticScrollAnimator::resetAnimationState()
|
| @@ -138,13 +133,8 @@ void ProgrammaticScrollAnimator::updateCompositorAnimations()
|
| // animation is added below.
|
| ASSERT(m_runState == RunState::WaitingToCancelOnCompositor || m_runState == RunState::WaitingToSendToCompositor);
|
|
|
| - if (m_compositorPlayer) {
|
| - if (m_compositorPlayer->isLayerAttached())
|
| - m_compositorPlayer->removeAnimation(m_compositorAnimationId);
|
| - } else {
|
| - if (GraphicsLayer* layer = m_scrollableArea->layerForScrolling())
|
| - layer->removeAnimation(m_compositorAnimationId);
|
| - }
|
| + if (m_compositorPlayer->isLayerAttached())
|
| + m_compositorPlayer->removeAnimation(m_compositorAnimationId);
|
|
|
| m_compositorAnimationId = 0;
|
| m_compositorAnimationGroupId = 0;
|
| @@ -164,15 +154,8 @@ void ProgrammaticScrollAnimator::updateCompositorAnimations()
|
| int animationId = animation->id();
|
| int animationGroupId = animation->group();
|
|
|
| - bool animatonAdded = false;
|
| - if (m_compositorPlayer && m_compositorPlayer->isLayerAttached()) {
|
| + if (m_compositorPlayer->isLayerAttached()) {
|
| m_compositorPlayer->addAnimation(animation.leakPtr());
|
| - animatonAdded = true;
|
| - } else {
|
| - animatonAdded = m_scrollableArea->layerForScrolling()->addAnimation(animation.release());
|
| - }
|
| -
|
| - if (animatonAdded) {
|
| sentToCompositor = true;
|
| m_runState = RunState::RunningOnCompositor;
|
| m_compositorAnimationId = animationId;
|
| @@ -193,11 +176,10 @@ void ProgrammaticScrollAnimator::updateCompositorAnimations()
|
|
|
| void ProgrammaticScrollAnimator::layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline* timeline)
|
| {
|
| - if (m_compositorPlayer && timeline) {
|
| - if (m_compositorPlayer->isLayerAttached())
|
| - m_compositorPlayer->detachLayer();
|
| - timeline->playerDestroyed(*this);
|
| - }
|
| + if (m_compositorPlayer->isLayerAttached())
|
| + m_compositorPlayer->detachLayer();
|
| +
|
| + timeline->playerDestroyed(*this);
|
|
|
| // If the composited scrolling layer is lost during a composited animation,
|
| // continue the animation on the main thread.
|
| @@ -213,15 +195,19 @@ void ProgrammaticScrollAnimator::layerForCompositedScrollingDidChange(WebComposi
|
| }
|
| }
|
|
|
| - if (m_compositorPlayer && timeline && m_scrollableArea->layerForScrolling()) {
|
| + if (m_scrollableArea->layerForScrolling()) {
|
| timeline->playerAttached(*this);
|
| m_compositorPlayer->attachLayer(m_scrollableArea->layerForScrolling()->platformLayer());
|
| }
|
| }
|
|
|
| -void ProgrammaticScrollAnimator::notifyCompositorAnimationFinished(int groupId)
|
| +void ProgrammaticScrollAnimator::notifyAnimationStarted(double monotonicTime, int group)
|
| {
|
| - if (m_compositorAnimationGroupId != groupId)
|
| +}
|
| +
|
| +void ProgrammaticScrollAnimator::notifyAnimationFinished(double monotonicTime, int group)
|
| +{
|
| + if (m_compositorAnimationGroupId != group)
|
| return;
|
|
|
| m_compositorAnimationId = 0;
|
| @@ -240,15 +226,6 @@ void ProgrammaticScrollAnimator::notifyCompositorAnimationFinished(int groupId)
|
| }
|
| }
|
|
|
| -void ProgrammaticScrollAnimator::notifyAnimationStarted(double monotonicTime, int group)
|
| -{
|
| -}
|
| -
|
| -void ProgrammaticScrollAnimator::notifyAnimationFinished(double monotonicTime, int group)
|
| -{
|
| - notifyCompositorAnimationFinished(group);
|
| -}
|
| -
|
| WebCompositorAnimationPlayer* ProgrammaticScrollAnimator::compositorPlayer() const
|
| {
|
| return m_compositorPlayer.get();
|
|
|