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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 393713002: Scroll offset animation curve retargeting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove workaround. Created 6 years, 5 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 | « cc/animation/timing_function.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 539eac4825881d6cd7c92bcffdb4b07782c7f568..f58272fc99f662d53e719e3cece7db57e0f459af 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2320,9 +2320,25 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta) {
- if (CurrentlyScrollingLayer()) {
- // TODO(skobes): Update the target of the existing animation.
- return ScrollIgnored;
+ if (LayerImpl* layer_impl = CurrentlyScrollingLayer()) {
+ Animation* animation =
+ layer_impl->layer_animation_controller()->GetAnimation(
+ Animation::ScrollOffset);
+ if (!animation)
+ return ScrollIgnored;
+
+ ScrollOffsetAnimationCurve* curve =
+ animation->curve()->ToScrollOffsetAnimationCurve();
+
+ gfx::Vector2dF new_target = curve->target_value() + scroll_delta;
+ new_target.SetToMax(gfx::Vector2dF());
+ new_target.SetToMin(layer_impl->MaxScrollOffset());
+
+ curve->UpdateTarget(
+ animation->TrimTimeToCurrentIteration(CurrentFrameTimeTicks()),
+ new_target);
+
+ return ScrollStarted;
}
// ScrollAnimated is only used for wheel scrolls. We use the same bubbling
// behavior as ScrollBy to determine which layer to animate, but we do not
@@ -2359,7 +2375,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
curve->SetInitialValue(current_offset);
scoped_ptr<Animation> animation =
- Animation::Create(curve->Clone().Pass(),
+ Animation::Create(curve.PassAs<AnimationCurve>(),
AnimationIdProvider::NextAnimationId(),
AnimationIdProvider::NextGroupId(),
Animation::ScrollOffset);
« no previous file with comments | « cc/animation/timing_function.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698