OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/touch_fling_gesture_curve.h" | 5 #include "content/child/touch_fling_gesture_curve.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 WebFloatSize scroll(displacement * displacement_ratio_.x, | 143 WebFloatSize scroll(displacement * displacement_ratio_.x, |
144 displacement * displacement_ratio_.y); | 144 displacement * displacement_ratio_.y); |
145 WebFloatSize scroll_increment(scroll.width - cumulative_scroll_.width, | 145 WebFloatSize scroll_increment(scroll.width - cumulative_scroll_.width, |
146 scroll.height - cumulative_scroll_.height); | 146 scroll.height - cumulative_scroll_.height); |
147 WebFloatSize scroll_velocity(speed * displacement_ratio_.x, | 147 WebFloatSize scroll_velocity(speed * displacement_ratio_.x, |
148 speed * displacement_ratio_.y); | 148 speed * displacement_ratio_.y); |
149 cumulative_scroll_ = scroll; | 149 cumulative_scroll_ = scroll; |
150 | 150 |
151 if (time + time_offset_ < curve_duration_ || | 151 if (time + time_offset_ < curve_duration_ || |
152 scroll_increment != WebFloatSize()) { | 152 scroll_increment != WebFloatSize()) { |
153 target->notifyCurrentFlingVelocity(scroll_velocity); | |
154 // scrollBy() could delete this curve if the animation is over, so don't | 153 // scrollBy() could delete this curve if the animation is over, so don't |
155 // touch any member variables after making that call. | 154 // touch any member variables after making that call. |
156 target->scrollBy(scroll_increment); | 155 return target->scrollBy(scroll_increment, scroll_velocity); |
157 return true; | |
158 } | 156 } |
159 | 157 |
160 return false; | 158 return false; |
161 } | 159 } |
162 | 160 |
163 } // namespace content | 161 } // namespace content |
OLD | NEW |