summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h
diff options
context:
space:
mode:
authornoel <noel@chromium.org>2015-12-23 03:37:55 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-23 11:38:50 +0000
commitae22bfdbb0ca73fd84c1eece143da72e30b08f66 (patch)
tree9ab8d0258fc3b2b38b55cdcd17414f730c9938c4 /third_party/WebKit/Source/platform/scroll/ScrollAnimator.h
parent2b7b5550416097a10d9373bc5f0810201d5f127d (diff)
downloadchromium_src-ae22bfdbb0ca73fd84c1eece143da72e30b08f66.zip
chromium_src-ae22bfdbb0ca73fd84c1eece143da72e30b08f66.tar.gz
chromium_src-ae22bfdbb0ca73fd84c1eece143da72e30b08f66.tar.bz2
Reland of un smooth scroll animations on the compositor when possible (patchset #1 id:1 of https://codereview.chromium.org/1548883002/ )
Reason for revert: The revert did not help, the tests virtual/threaded/fast/scroll-behavior/overflow-scroll-root-frame-animates.html virtual/threaded/fast/scroll-behavior/overflow-scroll-animates.html are now slower and hitting test timeout limits. Original issue's description: > Revert of Run smooth scroll animations on the compositor when possible (patchset #4 id:60001 of https://codereview.chromium.org/1534813004/ ) > > Reason for revert: > Appears to have made Linux debug builds fail the following tests: > > virtual/threaded/fast/scroll-behavior/overflow-scroll-root-frame-animates.html > virtual/threaded/fast/scroll-behavior/overflow-scroll-animates.html > > https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20%28dbg%29/builds/5360 > > Reverting to green the Blink tree. > > Original issue's description: > > Run smooth scroll animations on the compositor when possible > > > > This CL implements "immediate retargeting" shown in the following diagram: > > https://docs.google.com/drawings/d/1z76m-GMDgLI-clkfroLJ-5yhsHkmriZr_swP0kn5iw4 > > > > This CL does the following > > - Add a new state to ScrollAnimatorCompositorCoordinator to update the target > > offset on the compositor > > - Use the ScrollAnimatorCompositorCoordinator to schedule anim > > - Add plumbing from the animators to the animation controller to abort > > animations > > > > Sample test pages: > > yashmalik.com/nested_scroll_mousewheel_listener.html > > yashmalik.com/nested_scroll_mousewheel_listener_15ms_janky.html (tight loop in RAF) > > > > BUG=552556 > > CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel > > > > Committed: https://crrev.com/5534a2b2972534b523014c803e1e0e0541855cc7 > > Cr-Commit-Position: refs/heads/master@{#366685} > > TBR=skobes@chromium.org,ajuma@chromium.org,vollick@chromium.org,rbyers@chromium.org,ymalik@chromium.org > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=552556 > > Committed: https://crrev.com/51059d9d038aa255afdddfcbd3d418eb42b718ff > Cr-Commit-Position: refs/heads/master@{#366733} TBR=skobes@chromium.org,ajuma@chromium.org,vollick@chromium.org,rbyers@chromium.org,ymalik@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=552556 Review URL: https://codereview.chromium.org/1543043004 Cr-Commit-Position: refs/heads/master@{#366739}
Diffstat (limited to 'third_party/WebKit/Source/platform/scroll/ScrollAnimator.h')
-rw-r--r--third_party/WebKit/Source/platform/scroll/ScrollAnimator.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h
index 01746e68..5d8f20a 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h
@@ -34,11 +34,14 @@
#include "platform/Timer.h"
#include "platform/geometry/FloatPoint.h"
#include "platform/scroll/ScrollAnimatorBase.h"
+#include "public/platform/WebCompositorAnimationDelegate.h"
+#include "public/platform/WebCompositorAnimationPlayerClient.h"
#include "public/platform/WebScrollOffsetAnimationCurve.h"
namespace blink {
class ScrollAnimatorTest;
+class WebCompositorAnimationTimeline;
class PLATFORM_EXPORT ScrollAnimator final : public ScrollAnimatorBase {
public:
@@ -50,20 +53,26 @@ public:
ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGranularity, float step, float delta) override;
void scrollToOffsetWithoutAnimation(const FloatPoint&) override;
- void cancelAnimations() override;
- void serviceScrollAnimations() override;
- bool hasRunningAnimation() const override;
+ // ScrollAnimatorCompositorCoordinator implementation.
+ void tickAnimation(double monotonicTime) override;
+ void cancelAnimation() override;
+ void resetAnimationState() override;
+ void updateCompositorAnimations() override;
+ void notifyCompositorAnimationFinished(int groupId) override;
+ void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) override;
DECLARE_VIRTUAL_TRACE();
protected:
- void animationTimerFired();
-
OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve;
+ double m_lastTickTime;
double m_startTime;
WTF::TimeFunction m_timeFunction;
+
private:
FloatPoint desiredTargetPosition() const;
+
+ FloatPoint m_targetOffset;
};
} // namespace blink