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); |