| 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 f72a2d80fa59531bef442f2988cc35bd91535451..5d52678d06d10d7b31a0d551135426f8f5d0f936 100644
|
| --- a/cc/animation/scroll_offset_animations_impl.cc
|
| +++ b/cc/animation/scroll_offset_animations_impl.cc
|
| @@ -36,13 +36,14 @@ ScrollOffsetAnimationsImpl::~ScrollOffsetAnimationsImpl() {
|
| void ScrollOffsetAnimationsImpl::ScrollAnimationCreate(
|
| ElementId element_id,
|
| const gfx::ScrollOffset& target_offset,
|
| - const gfx::ScrollOffset& current_offset) {
|
| + const gfx::ScrollOffset& current_offset,
|
| + base::TimeDelta delayed_by) {
|
| std::unique_ptr<ScrollOffsetAnimationCurve> curve =
|
| ScrollOffsetAnimationCurve::Create(
|
| target_offset, CubicBezierTimingFunction::CreatePreset(
|
| CubicBezierTimingFunction::EaseType::EASE_IN_OUT),
|
| ScrollOffsetAnimationCurve::DurationBehavior::INVERSE_DELTA);
|
| - curve->SetInitialValue(current_offset);
|
| + curve->SetInitialValue(current_offset, delayed_by);
|
|
|
| std::unique_ptr<Animation> animation = Animation::Create(
|
| std::move(curve), AnimationIdProvider::NextAnimationId(),
|
| @@ -61,7 +62,8 @@ bool ScrollOffsetAnimationsImpl::ScrollAnimationUpdateTarget(
|
| ElementId element_id,
|
| const gfx::Vector2dF& scroll_delta,
|
| const gfx::ScrollOffset& max_scroll_offset,
|
| - base::TimeTicks frame_monotonic_time) {
|
| + base::TimeTicks frame_monotonic_time,
|
| + base::TimeDelta delayed_by) {
|
| DCHECK(scroll_offset_animation_player_);
|
| if (!scroll_offset_animation_player_->element_animations())
|
| return false;
|
| @@ -93,6 +95,11 @@ bool ScrollOffsetAnimationsImpl::ScrollAnimationUpdateTarget(
|
| ? base::TimeDelta()
|
| : animation->TrimTimeToCurrentIteration(frame_monotonic_time);
|
|
|
| + // Re-target taking the delay into account. Note that if the duration of the
|
| + // animation is 0, trimmed will be 0 and UpdateTarget will be called with
|
| + // t = -delayed_by.
|
| + trimmed -= delayed_by;
|
| +
|
| curve->UpdateTarget(trimmed.InSecondsF(), new_target);
|
|
|
| return true;
|
|
|