Commit e8259922 authored by Sahel Sharify's avatar Sahel Sharify Committed by Commit Bot

GSU events with touchpad source and inertial phase should get bubbled.

This cl is a fix for the following cl:
https://chromium-review.googlesource.com/c/chromium/src/+/1281687

The original cl fixes the crbug.com/884728 by making sure that
the GSU/GSE events with inertial phase are not bubbled to the parent.
In the original cl Mac is an exception since on this platform the GSU
events with inertial phase are received from the OS rather than being
generated by the fling controller.

What the original cl is missing is that Mac is not the only platform
on which we receive GSU events with inertial phase from OS. On Windows
devices with high precision touchpad the same thing happens.

This cl makes sure that we only stop bubbling the GSU/GSE events that are
generated from the fling controller: i.e. GSU/GSE events with inertial
phase that are either from touchscreen source or from touchpad source
but on ChromeOS only. (touchpad fling happens on chromeOS only, and on Mac
and on Windows(high precision touchpad) GSU events with inertial phase are
not generated by the fling controller.)

Bug: 884728, 897901
Change-Id: I5d620cc147707f1727c938a868a4082639095568
Reviewed-on: https://chromium-review.googlesource.com/c/1294398
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Reviewed-by: default avatarCharlie Reis <creis@chromium.org>
Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Reviewed-by: default avatarKevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601765}
parent 4372a3a9
...@@ -355,6 +355,8 @@ IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest, ...@@ -355,6 +355,8 @@ IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest,
WaitForFrameScroll(GetRootNode(), 15, true /* upward */); WaitForFrameScroll(GetRootNode(), 15, true /* upward */);
} }
// Touchpad fling only happens on ChromeOS.
#if defined(CHROMEOS)
IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest, IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest,
TouchpadFlingBubblesFromOOPIF) { TouchpadFlingBubblesFromOOPIF) {
LoadPageWithOOPIF(); LoadPageWithOOPIF();
...@@ -372,6 +374,8 @@ IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest, ...@@ -372,6 +374,8 @@ IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest,
SimulateTouchpadFling(child_view_->host(), GetWidgetHost(), fling_velocity); SimulateTouchpadFling(child_view_->host(), GetWidgetHost(), fling_velocity);
WaitForFrameScroll(GetRootNode(), 15, true /* upward */); WaitForFrameScroll(GetRootNode(), 15, true /* upward */);
} }
#endif // defined(CHROMEOS)
IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest, GFCGetsBubbledFromOOPIF) { IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest, GFCGetsBubbledFromOOPIF) {
LoadPageWithOOPIF(); LoadPageWithOOPIF();
// Scroll the parent down so that it is scrollable upward. // Scroll the parent down so that it is scrollable upward.
......
...@@ -516,23 +516,36 @@ void RenderWidgetHostViewChildFrame::GestureEventAck( ...@@ -516,23 +516,36 @@ void RenderWidgetHostViewChildFrame::GestureEventAck(
ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS || ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS ||
ack_result == INPUT_EVENT_ACK_STATE_CONSUMED_SHOULD_BUBBLE; ack_result == INPUT_EVENT_ACK_STATE_CONSUMED_SHOULD_BUBBLE;
// The inertial events on Mac should still get bubbled since there is no GFS to bool touchpad_fling_start_bubbles = false;
// bubble and the inertial events are received from the OS. // GSU events with inertial phase are generated from touchpad fling only on
#if !defined(OS_MACOSX) // ChromeOS. Other platforms either don't have touchpad-based GSUs with inertial
// phase (e.g., Linux/Android, or Windows with low precision touchpads) or
// generate them from the OS rather than the fling controller (e.g., Mac, or
// Windows with high precision touchpads). |touchpad_fling_start_bubbles| is
// true on ChromeOS to show that on this platform we do not need to bubble
// touchpad-based GSU events with inertial phase, since touchpad-based fling
// start gets bubbled instead and the fling controller of the parent will take
// care of touchpad-based inertial GSUs event creation from the bubbled touchpad
// fling.
#if defined(CHROMEOS)
touchpad_fling_start_bubbles = true;
#endif // defined(CHROMEOS)
// When a GFS is bubbled, we still send it to the fling controller of the // When a GFS is bubbled, we still send it to the fling controller of the
// child view to finish the scroll sequence. However the GSU and GSE events // child view to finish the scroll sequence. However the GSU and GSE events
// that are generated by the child view's fling controller do not need to get // that are generated by the child view's fling controller do not need to get
// bubbled since the GFS event itself is bubbled and the target's fling // bubbled since the GFS event itself is bubbled and the target's fling
// controller will take care of flinging. // controller will take care of flinging.
if ((event.GetType() == blink::WebInputEvent::kGestureScrollEnd && if (((event.GetType() == blink::WebInputEvent::kGestureScrollEnd &&
event.data.scroll_end.inertial_phase == event.data.scroll_end.inertial_phase ==
blink::WebGestureEvent::kMomentumPhase) || blink::WebGestureEvent::kMomentumPhase) ||
(event.GetType() == blink::WebInputEvent::kGestureScrollUpdate && (event.GetType() == blink::WebInputEvent::kGestureScrollUpdate &&
event.data.scroll_update.inertial_phase == event.data.scroll_update.inertial_phase ==
blink::WebGestureEvent::kMomentumPhase)) { blink::WebGestureEvent::kMomentumPhase)) &&
(event.SourceDevice() != blink::kWebGestureDeviceTouchpad ||
touchpad_fling_start_bubbles)) {
return; return;
} }
#endif // defined(OS_MACOSX)
if ((event.GetType() == blink::WebInputEvent::kGestureScrollBegin) && if ((event.GetType() == blink::WebInputEvent::kGestureScrollBegin) &&
should_bubble) { should_bubble) {
......
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