Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1217)

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp

Issue 1534813004: Run smooth scroll animations on the compositor when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 dc3a7ca882bf30a320d76c34d6b720683e2947e6..5af07c8e5f9e96bd4ec87fe3df0d4b8472bdf4f8 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp
@@ -52,6 +52,7 @@ bool ScrollAnimatorCompositorCoordinator::hasAnimationThatRequiresService() cons
return false;
case RunState::WaitingToSendToCompositor:
case RunState::RunningOnMainThread:
+ case RunState::RunningOnCompositorButNeedsUpdate:
case RunState::WaitingToCancelOnCompositor:
return true;
}
@@ -84,6 +85,17 @@ void ScrollAnimatorCompositorCoordinator::removeAnimation()
}
}
+void ScrollAnimatorCompositorCoordinator::abortAnimation()
+{
+ if (m_compositorPlayer) {
+ if (m_compositorPlayer->isLayerAttached())
+ m_compositorPlayer->abortAnimation(m_compositorAnimationId);
+ } else {
+ if (GraphicsLayer* layer = scrollableArea()->layerForScrolling())
+ layer->abortAnimation(m_compositorAnimationId);
+ }
+}
+
void ScrollAnimatorCompositorCoordinator::cancelAnimation()
{
switch (m_runState) {
@@ -101,6 +113,7 @@ void ScrollAnimatorCompositorCoordinator::cancelAnimation()
case RunState::RunningOnMainThread:
resetAnimationState();
break;
+ case RunState::RunningOnCompositorButNeedsUpdate:
case RunState::RunningOnCompositor:
m_runState = RunState::WaitingToCancelOnCompositor;
@@ -126,6 +139,7 @@ void ScrollAnimatorCompositorCoordinator::compositorAnimationFinished(
case RunState::WaitingToSendToCompositor:
break;
case RunState::RunningOnCompositor:
+ case RunState::RunningOnCompositorButNeedsUpdate:
case RunState::WaitingToCancelOnCompositor:
resetAnimationState();
}

Powered by Google App Engine
This is Rietveld 408576698