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

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

Issue 1842623003: Correctly reset ScrollAnimator animation state after cancelling animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ab02ae1b29876a54f6bf9a60375de1bec3c4b0fc..af2340832e8dad8845e7a8f6ababeabbfe2ac122 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
@@ -112,6 +112,10 @@ ScrollResult ScrollAnimator::userScroll(
return ScrollAnimatorBase::userScroll(granularity, delta);
}
+ bool needsPostAnimationCleanup = m_runState == RunState::PostAnimationCleanup;
+ if (m_runState == RunState::PostAnimationCleanup)
+ resetAnimationState();
+
FloatSize consumedDelta = computeDeltaToConsume(delta);
FloatPoint targetPos = desiredTargetPosition();
@@ -125,6 +129,13 @@ ScrollResult ScrollAnimator::userScroll(
// unusedDelta. This differs from ScrollAnimatorMac currently.
return ScrollResult(true, true, 0, 0);
}
+
+ // If the run state when this method was called was PostAnimationCleanup and
+ // we're not starting an animation, stay in PostAnimationCleanup state so
+ // that the main thread scrolling reason can be removed.
+ if (needsPostAnimationCleanup)
+ m_runState = RunState::PostAnimationCleanup;
+
// Report unused delta only if there is no animation and we are not
// starting one. This ensures we latch for the duration of the
// animation rather than animating multiple scrollers at the same time.
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698