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 f72a2d80fa59531bef442f2988cc35bd91535451..2956dafead9a77e9b387dcf2024d6bddfe348f05 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,10 @@ bool ScrollOffsetAnimationsImpl::ScrollAnimationUpdateTarget( |
| ? base::TimeDelta() |
| : animation->TrimTimeToCurrentIteration(frame_monotonic_time); |
| + // Re-target taking the delay into account. |
| + if (delayed_by > base::TimeDelta()) |
|
tdresser
2016/08/25 15:55:54
!delayed_by.is_zero()
ymalik
2016/08/29 14:52:05
Covered this on chat, but for posterity:
delayed_b
|
| + trimmed = delayed_by < trimmed ? trimmed - delayed_by : base::TimeDelta(); |
|
tdresser
2016/08/25 15:55:54
I'm not completely clear on what's going on here.
tdresser
2016/08/29 14:31:33
Subtraction is just saturated. This seems reasonab
ymalik
2016/08/29 14:52:05
Yes. We're just trying to use the delay as a signa
|
| + |
| curve->UpdateTarget(trimmed.InSecondsF(), new_target); |
| return true; |