diff options
author | jdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-11 07:37:01 +0000 |
---|---|---|
committer | jdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-11 07:37:01 +0000 |
commit | 69f344bca279a259af31861c21d11b16cbb91ecf (patch) | |
tree | 371ce6a8667cdb6966f76f8b2a5da7c63a932874 /content/child | |
parent | a40ee401e8256cc4282c44c49d5f379a7a669858 (diff) | |
download | chromium_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')
-rw-r--r-- | content/child/OWNERS | 2 | ||||
-rw-r--r-- | content/child/touch_fling_gesture_curve.cc | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/content/child/OWNERS b/content/child/OWNERS index b212a3f..d486c11 100644 --- a/content/child/OWNERS +++ b/content/child/OWNERS @@ -1,5 +1,7 @@ per-file appcache*=michaeln@chromium.org +per-file *fling*=jdduke@chromium.org + # WebSocket per-file *websocket*=ricea@chromium.org per-file *websocket*=tyoshino@chromium.org 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_); |