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

Unified Diff: cc/animation/scroll_offset_animation_curve.cc

Issue 2332923002: Fix scroll animation UpdateTarget for zero-duration segments (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | cc/animation/scroll_offset_animation_curve_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/scroll_offset_animation_curve.cc
diff --git a/cc/animation/scroll_offset_animation_curve.cc b/cc/animation/scroll_offset_animation_curve.cc
index a3831432897b6f8b3b71295254768597d06f2e8e..16ff073655ca669e4c4f750dcea192c685871f51 100644
--- a/cc/animation/scroll_offset_animation_curve.cc
+++ b/cc/animation/scroll_offset_animation_curve.cc
@@ -228,6 +228,15 @@ void ScrollOffsetAnimationCurve::UpdateTarget(
gfx::Vector2dF old_delta = target_value_.DeltaFrom(initial_value_);
gfx::Vector2dF new_delta = new_target.DeltaFrom(current_position);
+ // The last segement was of zero duration.
+ if ((total_animation_duration_ - last_retarget_).is_zero()) {
+ DCHECK_EQ(t, last_retarget_.InSecondsF());
+ total_animation_duration_ =
+ SegmentDuration(new_delta, duration_behavior_, base::TimeDelta());
skobes 2016/09/12 22:45:46 Pass delayed_by here?
ymalik 2016/09/12 23:35:05 Done.
+ target_value_ = new_target;
+ return;
+ }
+
double old_duration =
(total_animation_duration_ - last_retarget_).InSecondsF();
double old_normalized_velocity = timing_function_->Velocity(
« no previous file with comments | « no previous file | cc/animation/scroll_offset_animation_curve_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698