Commit cbee8539 authored by jdduke's avatar jdduke Committed by Commit bot

Reset scroll status when a fling is ignored

In WebView, flings that target the root scrolling layer are ignored by
the compositor. In this case, we failed to clean up the scroll state in
InputHandlerProxy, leading it to believe that a scroll was still active
after the fling had been ignored. Handle this case, resetting the scroll
activity bit when a fling is ignored.

BUG=469369

Review URL: https://codereview.chromium.org/1028533004

Cr-Commit-Position: refs/heads/master@{#321932}
parent 97652ebe
...@@ -537,6 +537,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart( ...@@ -537,6 +537,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
"InputHandlerProxy::HandleGestureFling::" "InputHandlerProxy::HandleGestureFling::"
"scroll_on_main_thread", "scroll_on_main_thread",
TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_SCOPE_THREAD);
gesture_scroll_on_impl_thread_ = false;
fling_may_be_active_on_main_thread_ = true; fling_may_be_active_on_main_thread_ = true;
return DID_NOT_HANDLE; return DID_NOT_HANDLE;
} }
...@@ -545,6 +546,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart( ...@@ -545,6 +546,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
"input", "input",
"InputHandlerProxy::HandleGestureFling::ignored", "InputHandlerProxy::HandleGestureFling::ignored",
TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_SCOPE_THREAD);
gesture_scroll_on_impl_thread_ = false;
if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) { if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) {
// We still pass the curve to the main thread if there's nothing // We still pass the curve to the main thread if there's nothing
// scrollable, in case something // scrollable, in case something
......
...@@ -961,6 +961,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) { ...@@ -961,6 +961,8 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
expected_disposition_ = InputHandlerProxy::DROP_EVENT; expected_disposition_ = InputHandlerProxy::DROP_EVENT;
VERIFY_AND_RESET_MOCKS(); VERIFY_AND_RESET_MOCKS();
// Flings ignored by the InputHandler should be dropped, signalling the end
// of the touch scroll sequence.
EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) EXPECT_CALL(mock_input_handler_, FlingScrollBegin())
.WillOnce(testing::Return(cc::InputHandler::SCROLL_IGNORED)); .WillOnce(testing::Return(cc::InputHandler::SCROLL_IGNORED));
...@@ -970,9 +972,12 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) { ...@@ -970,9 +972,12 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
VERIFY_AND_RESET_MOCKS(); VERIFY_AND_RESET_MOCKS();
// Even if we didn't start a fling ourselves, we still need to send the cancel // Subsequent scrolls should behave normally, even without an intervening
// event to the widget. // GestureFlingCancel, as the original GestureFlingStart was dropped.
gesture_.type = WebInputEvent::GestureFlingCancel; expected_disposition_ = InputHandlerProxy::DID_HANDLE;
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment