diff options
author | wjarosik <wjarosik@opera.com> | 2014-12-16 08:52:32 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-16 16:52:57 +0000 |
commit | b6c0ec4b3a2aab896c2ace17d1fec5db729bad17 (patch) | |
tree | f1c15dbb361067bde2f398a5d47b346e9dd866e5 /content/renderer/input | |
parent | a6fbe4259193a49664e6c32749f872265222811d (diff) | |
download | chromium_src-b6c0ec4b3a2aab896c2ace17d1fec5db729bad17.zip chromium_src-b6c0ec4b3a2aab896c2ace17d1fec5db729bad17.tar.gz chromium_src-b6c0ec4b3a2aab896c2ace17d1fec5db729bad17.tar.bz2 |
Use Blink's flag to prevent fling boosting.
This flag prevents the flingCancel event from being used
as a part of a fling boost event sequence.
The synthetic FlingCancel method works properly now and cancels flings
instantly, without deferring flingCancel event.
See: https://codereview.chromium.org/789223002
BUG=440886
Review URL: https://codereview.chromium.org/792833002
Cr-Commit-Position: refs/heads/master@{#308599}
Diffstat (limited to 'content/renderer/input')
-rw-r--r-- | content/renderer/input/input_handler_proxy.cc | 3 | ||||
-rw-r--r-- | content/renderer/input/input_handler_proxy_unittest.cc | 20 |
2 files changed, 23 insertions, 0 deletions
diff --git a/content/renderer/input/input_handler_proxy.cc b/content/renderer/input/input_handler_proxy.cc index ce178ec..3edb957 100644 --- a/content/renderer/input/input_handler_proxy.cc +++ b/content/renderer/input/input_handler_proxy.cc @@ -567,6 +567,9 @@ bool InputHandlerProxy::FilterInputEventForFlingBoosting( const WebGestureEvent& gesture_event = static_cast<const WebGestureEvent&>(event); if (gesture_event.type == WebInputEvent::GestureFlingCancel) { + if (gesture_event.data.flingCancel.preventBoosting) + return false; + if (current_fling_velocity_.LengthSquared() < kMinBoostFlingSpeedSquare) return false; diff --git a/content/renderer/input/input_handler_proxy_unittest.cc b/content/renderer/input/input_handler_proxy_unittest.cc index aafe9187..cb85701 100644 --- a/content/renderer/input/input_handler_proxy_unittest.cc +++ b/content/renderer/input/input_handler_proxy_unittest.cc @@ -1954,6 +1954,26 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfFlingTooSlow) { VERIFY_AND_RESET_MOCKS(); } +TEST_F(InputHandlerProxyTest, NoFlingBoostIfPreventBoostingFlagIsSet) { + base::TimeDelta dt = base::TimeDelta::FromMilliseconds(10); + base::TimeTicks time = base::TimeTicks() + dt; + WebFloatPoint fling_delta = WebFloatPoint(1000, 0); + WebPoint fling_point = WebPoint(7, 13); + + StartFling( + time, blink::WebGestureDeviceTouchscreen, fling_delta, fling_point); + + EXPECT_CALL(mock_input_handler_, ScrollEnd()); + + // Cancel the fling. The fling cancellation should not be deferred because of + // prevent boosting flag set. + gesture_.data.flingCancel.preventBoosting = true; + time += dt; + CancelFling(time); + + // VERIFY_AND_RESET_MOCKS already called by CancelFling +} + TEST_F(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) { base::TimeDelta dt = base::TimeDelta::FromMilliseconds(10); base::TimeTicks time = base::TimeTicks() + dt; |