summaryrefslogtreecommitdiffstats
path: root/content/child/touch_fling_gesture_curve.cc
diff options
context:
space:
mode:
authorjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 07:37:01 +0000
committerjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 07:37:01 +0000
commit69f344bca279a259af31861c21d11b16cbb91ecf (patch)
tree371ce6a8667cdb6966f76f8b2a5da7c63a932874 /content/child/touch_fling_gesture_curve.cc
parenta40ee401e8256cc4282c44c49d5f379a7a669858 (diff)
downloadchromium_src-69f344bca279a259af31861c21d11b16cbb91ecf.zip
chromium_src-69f344bca279a259af31861c21d11b16cbb91ecf.tar.gz
chromium_src-69f344bca279a259af31861c21d11b16cbb91ecf.tar.bz2
Avoid fling termination with negative or small time deltas
If very little time has passed between calls to |InputHandlerProxy::Animate|, the generated scroll deltas will be zero, or very small. This can cause the fling to terminate, as the client will report that no scrolling has occurred. Fix this by never offering the client a zero scroll delta, and suppressing "did not scroll" propagation fi the scroll delta was sufficiently small. Also prevent the fling curve from generating scroll updates if it's provided a negative timestamp. BUG=360633 Review URL: https://codereview.chromium.org/233593002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/child/touch_fling_gesture_curve.cc')
-rw-r--r--content/child/touch_fling_gesture_curve.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/content/child/touch_fling_gesture_curve.cc b/content/child/touch_fling_gesture_curve.cc
index a05292f8..cc94bd6 100644
--- a/content/child/touch_fling_gesture_curve.cc
+++ b/content/child/touch_fling_gesture_curve.cc
@@ -125,12 +125,14 @@ TouchFlingGestureCurve::~TouchFlingGestureCurve() {
}
bool TouchFlingGestureCurve::apply(double time, WebGestureCurveTarget* target) {
+ // If the fling has yet to start, simply return and report true to prevent
+ // fling termination.
+ if (time <= 0)
+ return true;
+
float displacement;
float speed;
- if (time < 0) {
- displacement = 0.f;
- speed = 0.f;
- } else if (time + time_offset_ < curve_duration_) {
+ if (time + time_offset_ < curve_duration_) {
displacement =
position(time + time_offset_, coefficients_) - position_offset_;
speed = velocity(time + time_offset_, coefficients_);