Commit f4abba7f authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

Prevent touchscreen pinch events from being sent to child renderers

If we pinch an element with a touch-action that prevents pinch in an
OOPIF, we route the pinch events to the child so that the child's
TouchActionFilter filters them. Due to crbug.com/771330, the
TouchActionFilter could let the pinch events through. We'll
filter such events in RenderWidgetHostViewChildFrame::FilterInputEvent
to prevent them from being sent to the child renderer.

Bug: 827182
Change-Id: I3782a2d135a008df271a73d79ecade25dcc9f1a5
Reviewed-on: https://chromium-review.googlesource.com/1040354Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555743}
parent dcecaa82
......@@ -956,6 +956,19 @@ void RenderWidgetHostViewChildFrame::TakeFallbackContentFrom(
InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent(
const blink::WebInputEvent& input_event) {
// A child renderer should not receive touchscreen pinch events. Ideally, we
// would DCHECK this, but since touchscreen pinch events may be targeted to
// a child in order to have the child's TouchActionFilter filter them, we
// may encounter https://crbug.com/771330 which would let the pinch events
// through.
if (blink::WebInputEvent::IsPinchGestureEventType(input_event.GetType())) {
const blink::WebGestureEvent& gesture_event =
static_cast<const blink::WebGestureEvent&>(input_event);
if (gesture_event.SourceDevice() == blink::kWebGestureDeviceTouchscreen) {
return INPUT_EVENT_ACK_STATE_CONSUMED;
}
}
if (input_event.GetType() == blink::WebInputEvent::kGestureFlingStart) {
const blink::WebGestureEvent& gesture_event =
static_cast<const blink::WebGestureEvent&>(input_event);
......
......@@ -3571,6 +3571,7 @@ class SitePerProcessGestureHitTestBrowserTest
ui::ET_GESTURE_SCROLL_BEGIN);
gesture_scroll_begin_details.set_device_type(
ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
gesture_scroll_begin_details.set_touch_points(2);
ui::GestureEvent gesture_scroll_begin(
position.x(), position.y(), 0, ui::EventTimeForNow(),
gesture_scroll_begin_details, touch_pressed.unique_event_id());
......
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