Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp |
| diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp |
| index 41858117597c83e260d30c92e1c10d6dba15207d..2ce7430336948a04783acb0af83f66f63bf838e1 100644 |
| --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp |
| +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp |
| @@ -6,6 +6,7 @@ |
| #include "cc/animation/scroll_offset_animation_curve.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| +#include "platform/animation/CompositorAnimationHost.h" |
| #include "platform/animation/CompositorAnimationPlayer.h" |
| #include "platform/animation/CompositorAnimationTimeline.h" |
| #include "platform/graphics/CompositorFactory.h" |
| @@ -47,6 +48,9 @@ void ScrollAnimatorCompositorCoordinator::resetAnimationState() |
| bool ScrollAnimatorCompositorCoordinator::hasAnimationThatRequiresService() const |
| { |
| + if (!m_implOnlyAnimationAdjustments.empty()) |
| + return true; |
| + |
| switch (m_runState) { |
| case RunState::Idle: |
| case RunState::RunningOnCompositor: |
| @@ -238,6 +242,33 @@ FloatPoint ScrollAnimatorCompositorCoordinator::blinkOffsetFromCompositorOffset( |
| return offset; |
| } |
| +void ScrollAnimatorCompositorCoordinator::updateCompositorAnimations() |
| +{ |
| + if (!getScrollableArea()->scrollAnimatorEnabled()) |
| + return; |
| + |
| + CompositorAnimationTimeline* timeline = getScrollableArea()->compositorAnimationTimeline(); |
| + if (getScrollableArea()->layerForScrolling() && timeline && !timeline->compositorAnimationHost().isNull()) { |
|
jbroman
2016/05/16 19:15:11
nit: This is getting a little long. Suggest factor
ymalik
2016/05/16 20:52:35
Done.
|
| + CompositorAnimationHost host = timeline->compositorAnimationHost(); |
| + for (auto& update : m_implOnlyAnimationAdjustments) { |
| + cc::ElementId elementId = getScrollableArea()->layerForScrolling()->platformLayer()->id(); |
| + host.updateImplOnlyScrollOffsetAnimation( |
|
jbroman
2016/05/16 19:15:11
Just checking: I assume that it's necessary to sen
ymalik
2016/05/16 20:52:35
You're right that the updates don't need to be sen
|
| + gfx::Vector2dF(update.width(), update.height()), elementId); |
| + } |
| + } |
| + m_implOnlyAnimationAdjustments.clear(); |
| +} |
| + |
| +void ScrollAnimatorCompositorCoordinator::updateImplOnlyScrollOffsetAnimation( |
| + const FloatSize& adjustment) |
| +{ |
| + if (!getScrollableArea()->scrollAnimatorEnabled()) |
| + return; |
| + |
| + m_implOnlyAnimationAdjustments.push_back(adjustment); |
| + getScrollableArea()->registerForAnimation(); |
| +} |
| + |
| String ScrollAnimatorCompositorCoordinator::runStateAsText() const |
| { |
| switch (m_runState) { |