Chromium Code Reviews| Index: cc/animation/scroll_offset_animations_impl.cc |
| diff --git a/cc/animation/scroll_offset_animations_impl.cc b/cc/animation/scroll_offset_animations_impl.cc |
| index ffebdbcd5e76bdae3f1666dfd8f9384d4235b25d..ebe24dfb89552bee4472de8380dc9094127841ef 100644 |
| --- a/cc/animation/scroll_offset_animations_impl.cc |
| +++ b/cc/animation/scroll_offset_animations_impl.cc |
| @@ -90,6 +90,45 @@ bool ScrollOffsetAnimationsImpl::ScrollAnimationUpdateTarget( |
| return true; |
| } |
| +void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment( |
| + ElementId element_id, |
| + const gfx::Vector2dF& adjustment, |
| + base::TimeTicks frame_monotonic_time) { |
| + DCHECK(scroll_offset_animation_player_); |
| + if (element_id != scroll_offset_animation_player_->element_id()) |
| + return; |
| + |
| + if (!scroll_offset_animation_player_->element_animations()) |
| + return; |
| + |
| + Animation* animation = |
| + scroll_offset_animation_player_->element_animations()->GetAnimation( |
| + TargetProperty::SCROLL_OFFSET); |
| + if (!animation) |
| + return; |
| + |
| + // Abort the old animation. |
| + ScrollAnimationAbort(/* needs_completion */ false); |
| + |
| + // Start a new one with the adjusment. |
| + std::unique_ptr<ScrollOffsetAnimationCurve> new_curve = |
| + animation->curve() |
| + ->ToScrollOffsetAnimationCurve() |
| + ->CloneToScrollOffsetAnimationCurve(); |
| + new_curve->ApplyAdjustment( |
| + animation->TrimTimeToCurrentIteration(frame_monotonic_time), adjustment); |
| + |
| + std::unique_ptr<Animation> new_animation = Animation::Create( |
| + std::move(new_curve), AnimationIdProvider::NextAnimationId(), |
| + AnimationIdProvider::NextGroupId(), TargetProperty::SCROLL_OFFSET); |
| + new_animation->set_is_impl_only(true); |
| + new_animation->set_affects_active_elements(false); |
| + |
| + ReattachScrollOffsetPlayerIfNeeded(element_id); |
|
loyso (OOO)
2016/05/06 01:04:38
element_id == scroll_offset_animation_player_->ele
ymalik
2016/05/06 05:41:49
You're right, no need to reattach.
We can't repla
|
| + |
| + scroll_offset_animation_player_->AddAnimation(std::move(new_animation)); |
| +} |
| + |
| void ScrollOffsetAnimationsImpl::ScrollAnimationAbort(bool needs_completion) { |
| DCHECK(scroll_offset_animation_player_); |
| scroll_offset_animation_player_->AbortAnimations( |