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

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: attempt to fix rebase issue 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
« no previous file with comments | « cc/animation/scroll_offset_animation_curve.h ('k') | cc/animation/scroll_offset_animations.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 const gfx::Vector2dF& adjustment) {
113 initial_value_ = ScrollOffsetWithDelta(initial_value_, adjustment);
114 target_value_ = ScrollOffsetWithDelta(target_value_, adjustment);
115 }
116
111 gfx::ScrollOffset ScrollOffsetAnimationCurve::GetValue( 117 gfx::ScrollOffset ScrollOffsetAnimationCurve::GetValue(
112 base::TimeDelta t) const { 118 base::TimeDelta t) const {
113 base::TimeDelta duration = total_animation_duration_ - last_retarget_; 119 base::TimeDelta duration = total_animation_duration_ - last_retarget_;
114 t -= last_retarget_; 120 t -= last_retarget_;
115 121
116 if (t <= base::TimeDelta()) 122 if (t <= base::TimeDelta())
117 return initial_value_; 123 return initial_value_;
118 124
119 if (t >= duration) 125 if (t >= duration)
120 return target_value_; 126 return target_value_;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 (MaximumDimension(old_delta) / MaximumDimension(new_delta)); 226 (MaximumDimension(old_delta) / MaximumDimension(new_delta));
221 227
222 initial_value_ = current_position; 228 initial_value_ = current_position;
223 target_value_ = new_target; 229 target_value_ = new_target;
224 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration); 230 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration);
225 last_retarget_ = base::TimeDelta::FromSecondsD(t); 231 last_retarget_ = base::TimeDelta::FromSecondsD(t);
226 timing_function_ = EaseOutWithInitialVelocity(new_normalized_velocity); 232 timing_function_ = EaseOutWithInitialVelocity(new_normalized_velocity);
227 } 233 }
228 234
229 } // namespace cc 235 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/scroll_offset_animation_curve.h ('k') | cc/animation/scroll_offset_animations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698