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

Unified Diff: cc/animation/scroll_offset_animation_curve.cc

Issue 2040543002: Take MT jank into account when animating the scroll offset on CC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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 5b95f561685fa48533c61b4a1efebb5c894ae3e0..7655b0da5a4f1e52a3d48d6a566e964e72e2f133 100644
--- a/cc/animation/scroll_offset_animation_curve.cc
+++ b/cc/animation/scroll_offset_animation_curve.cc
@@ -114,17 +114,25 @@ void ScrollOffsetAnimationCurve::ApplyAdjustment(
target_value_ = ScrollOffsetWithDelta(target_value_, adjustment);
}
+void ScrollOffsetAnimationCurve::AdjustDuration(base::TimeDelta adjustment) {
+ base::TimeDelta old_duration = total_animation_duration_ - last_retarget_;
+ base::TimeDelta new_duration = old_duration - adjustment;
+ if (new_duration <= base::TimeDelta())
+ new_duration = base::TimeDelta();
+ total_animation_duration_ -= old_duration - new_duration;
+}
+
gfx::ScrollOffset ScrollOffsetAnimationCurve::GetValue(
base::TimeDelta t) const {
base::TimeDelta duration = total_animation_duration_ - last_retarget_;
t -= last_retarget_;
- if (t <= base::TimeDelta())
- return initial_value_;
-
if (t >= duration)
return target_value_;
+ if (t <= base::TimeDelta())
+ return initial_value_;
+
double progress = timing_function_->GetValue(TimeUtil::Divide(t, duration));
return gfx::ScrollOffset(
gfx::Tween::FloatValueBetween(

Powered by Google App Engine
This is Rietveld 408576698