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

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

Issue 1678713002: Correctly handle cancelling compositor animations initiated from main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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/ScrollAnimator.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
index de0000b4a8f5a948cb00f564d08a62014024fb01..9024ccc84ca536d98be100bbd5ea8e5da9d740af 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
@@ -110,6 +110,13 @@ ScrollResultOneDimensional ScrollAnimator::userScroll(
FloatPoint targetPos = desiredTargetPosition();
targetPos.moveBy(pixelDelta);
ymalik 2016/02/07 21:23:37 @ajuma This is speculatively fix up the assert fa
ajuma 2016/02/08 15:05:35 Assuming that userScroll can get called at arbitra
+ // Reset animation state in case we get a scroll between when an animation
+ // was asked to be cancelled and updateCompositorAnimations is called.
+ if (m_runState == RunState::WaitingToCancelOnCompositor) {
+ abortAnimation();
ajuma 2016/02/08 15:05:35 It looks like this could touch compositing state i
ymalik 2016/02/08 18:41:23 Ah right. That's why we have the whole state machi
+ resetAnimationState();
+ }
+
if (m_animationCurve) {
if ((targetPos - m_targetOffset).isZero()) {
// Report unused delta only if there is no animation running. See
@@ -189,23 +196,11 @@ void ScrollAnimator::tickAnimation(double monotonicTime)
void ScrollAnimator::updateCompositorAnimations()
{
ymalik 2016/02/07 21:23:37 I don't think we should ever be in a state where w
ajuma 2016/02/08 15:05:35 Sounds reasonable.
ymalik 2016/02/08 18:41:23 Based on your feedback above, I moved the call to
- if (m_compositorAnimationId && m_runState != RunState::RunningOnCompositor
- && m_runState != RunState::RunningOnCompositorButNeedsUpdate) {
- // If the current run state is WaitingToSendToCompositor but we have a
- // non-zero compositor animation id, there's a currently running
- // compositor animation that needs to be removed here before the new
- // animation is added below.
- ASSERT(m_runState == RunState::WaitingToCancelOnCompositor
- || m_runState == RunState::WaitingToSendToCompositor);
-
+ if (m_runState == RunState::WaitingToCancelOnCompositor) {
+ ASSERT(m_compositorAnimationId);
abortAnimation();
-
- m_compositorAnimationId = 0;
- m_compositorAnimationGroupId = 0;
- if (m_runState == RunState::WaitingToCancelOnCompositor) {
- resetAnimationState();
- return;
- }
+ resetAnimationState();
+ return;
}
if (m_runState == RunState::WaitingToSendToCompositor

Powered by Google App Engine
This is Rietveld 408576698