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

Side by Side Diff: cc/animation/scroll_offset_animation_curve.cc

Issue 1950243005: Communicate MT changes to impl-only scroll offset animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply initial feedback comments Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/animation/scroll_offset_animation_curve.h" 5 #include "cc/animation/scroll_offset_animation_curve.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 initial_value_ = initial_value; 101 initial_value_ = initial_value;
102 has_set_initial_value_ = true; 102 has_set_initial_value_ = true;
103 total_animation_duration_ = SegmentDuration( 103 total_animation_duration_ = SegmentDuration(
104 target_value_.DeltaFrom(initial_value_), duration_behavior_); 104 target_value_.DeltaFrom(initial_value_), duration_behavior_);
105 } 105 }
106 106
107 bool ScrollOffsetAnimationCurve::HasSetInitialValue() const { 107 bool ScrollOffsetAnimationCurve::HasSetInitialValue() const {
108 return has_set_initial_value_; 108 return has_set_initial_value_;
109 } 109 }
110 110
111 void ScrollOffsetAnimationCurve::ApplyAdjustment(
112 base::TimeDelta t,
113 const gfx::Vector2dF& adjustment) {
114 SetInitialValue(ScrollOffsetWithDelta(GetValue(t), adjustment));
skobes 2016/05/07 00:25:16 I don't think we want to call SetInitialValue here
ymalik 2016/05/10 19:40:59 We are starting essentially aborting the previous
ymalik 2016/05/12 22:31:25 Spoke to you offline. And you're right that we sho
115 target_value_ = ScrollOffsetWithDelta(target_value_, adjustment);
116 }
117
111 gfx::ScrollOffset ScrollOffsetAnimationCurve::GetValue( 118 gfx::ScrollOffset ScrollOffsetAnimationCurve::GetValue(
112 base::TimeDelta t) const { 119 base::TimeDelta t) const {
113 base::TimeDelta duration = total_animation_duration_ - last_retarget_; 120 base::TimeDelta duration = total_animation_duration_ - last_retarget_;
114 t -= last_retarget_; 121 t -= last_retarget_;
115 122
116 if (t <= base::TimeDelta()) 123 if (t <= base::TimeDelta())
117 return initial_value_; 124 return initial_value_;
118 125
119 if (t >= duration) 126 if (t >= duration)
120 return target_value_; 127 return target_value_;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 (MaximumDimension(old_delta) / MaximumDimension(new_delta)); 222 (MaximumDimension(old_delta) / MaximumDimension(new_delta));
216 223
217 initial_value_ = current_position; 224 initial_value_ = current_position;
218 target_value_ = new_target; 225 target_value_ = new_target;
219 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration); 226 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration);
220 last_retarget_ = base::TimeDelta::FromSecondsD(t); 227 last_retarget_ = base::TimeDelta::FromSecondsD(t);
221 timing_function_ = EaseOutWithInitialVelocity(new_normalized_velocity); 228 timing_function_ = EaseOutWithInitialVelocity(new_normalized_velocity);
222 } 229 }
223 230
224 } // namespace cc 231 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698