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

Side by Side Diff: content/child/touch_fling_gesture_curve.cc

Issue 136173004: Early terminate flings when scrolling impossible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 8 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 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
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
OLDNEW
« no previous file with comments | « content/child/fling_animator_impl_android.cc ('k') | content/child/touch_fling_gesture_curve_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698