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 798d468459513d8b21a29ba751733479481c3bfe..27dfece11f6ad9c1e092ba88961e180ddb50ae6b 100644 |
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp |
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp |
@@ -65,6 +65,7 @@ bool ScrollAnimatorCompositorCoordinator::hasAnimationThatRequiresService() cons |
case RunState::WaitingToSendToCompositor: |
case RunState::RunningOnMainThread: |
case RunState::RunningOnCompositorButNeedsUpdate: |
+ case RunState::RunningOnCompositorButNeedsTakeover: |
case RunState::WaitingToCancelOnCompositor: |
return true; |
} |
@@ -115,6 +116,7 @@ void ScrollAnimatorCompositorCoordinator::cancelAnimation() |
case RunState::WaitingToCancelOnCompositor: |
case RunState::PostAnimationCleanup: |
break; |
+ case RunState::RunningOnCompositorButNeedsTakeover: |
case RunState::WaitingToSendToCompositor: |
if (m_compositorAnimationId) { |
// We still have a previous animation running on the compositor. |
@@ -135,6 +137,30 @@ void ScrollAnimatorCompositorCoordinator::cancelAnimation() |
} |
} |
+void ScrollAnimatorCompositorCoordinator::takeoverCompositorAnimation() |
+{ |
+ switch (m_runState) { |
+ case RunState::Idle: |
+ case RunState::WaitingToCancelOnCompositor: |
+ case RunState::PostAnimationCleanup: |
+ case RunState::RunningOnCompositorButNeedsTakeover: |
+ case RunState::WaitingToSendToCompositor: |
+ case RunState::RunningOnMainThread: |
+ break; |
+ case RunState::RunningOnCompositorButNeedsUpdate: |
+ case RunState::RunningOnCompositor: |
+ // We call abortAnimation that makes changes to the animation running on |
+ // the compositor. Thus, this function should only be called when in |
+ // CompositingClean state. |
+ abortAnimation(); |
+ |
+ m_runState = RunState::RunningOnCompositorButNeedsTakeover; |
+ |
+ // Get serviced the next time compositor updates are allowed. |
+ scrollableArea()->registerForAnimation(); |
+ } |
+} |
+ |
void ScrollAnimatorCompositorCoordinator::compositorAnimationFinished( |
int groupId) |
{ |
@@ -154,6 +180,7 @@ void ScrollAnimatorCompositorCoordinator::compositorAnimationFinished( |
break; |
case RunState::RunningOnCompositor: |
case RunState::RunningOnCompositorButNeedsUpdate: |
+ case RunState::RunningOnCompositorButNeedsTakeover: |
case RunState::WaitingToCancelOnCompositor: |
m_runState = RunState::PostAnimationCleanup; |
// Get serviced the next time compositor updates are allowed. |