New issue
Advanced search Search tips

Issue 606938 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Suppress mouse events on tap & long press when pointerdown is consumed

Project Member Reported by rbyers@chromium.org, Apr 26 2016

Issue description

Enable pointer events support and open http://rbyers.net/eventTest.html
Enable the "pointer events" option (along with touch and mouse events) and the "preventdefault on pointerdown" option.  Then tap on the purple box.

Since consuming pointerdown for mouse suppresses generation of compatibility mouse events (but not click), it seems reasonable to expect something similar for touch.  What does Edge on Windows Phone (where they use gesture-based mouse events) do in this case?

If we decide we want 'click' but not 'mouse*' in this case, implementing that perfectly could be a little tricky.  Is it OK to just rely on the last "prevent mouse events" state in EventHandler?  Eg. what if the user double taps and the first pointerdown is cancelled but the second is not?  There would probably be a race with the delivery of the GestureTap events (especially if the tap delay is active).  We could flow some state back along the ACK and back with the corresponding gesture event, but that would probably be a pain.  Maybe the race condition is fine.
 

Comment 1 by rbyers@chromium.org, Apr 26 2016

Also applies to long press of course.

Comment 2 by mustaq@chromium.org, Apr 28 2016

Owner: mustaq@chromium.org
Status: Assigned (was: Unconfirmed)
Allowing click and blocking mouse* seems to be the solution here. But I didn't quite follow double-tap/long-press implication here: should mouseevents fired from touches even affect gesture event generation?

Comment 3 by mustaq@chromium.org, Apr 28 2016

Sending the prevent-default state back to GR seems to be the best solution here because the mouse* events (as well as the click) don't come from the touch directly, but they come from the gesture events produced from the touch. Thanks Rick for the clarification.

Comment 4 by mustaq@chromium.org, Apr 28 2016

Blocking: 471824
Sending the PE-prevent-defaulted state back to GR is not an option because for passive TE listeners, Blink doesn't even send back an ack.

Alternatively, Blink can "copy" the same touch-gesture sync done at InputRouter/TouchEventQueue level, to associate gesture events back to the original Touch/PointerEvent where it might have been canceled:
- plumb WebTouchEvent::uniqueTouchEventId to Blink,
- cache the prevent-defaulted uniqueTouchIds (per-touch-point) at EventHandler level, and
- stop firing MEs for gestures whose uniqueTouchIds are found in the cache.

Comment 5 by mustaq@chromium.org, Apr 28 2016

A. For touch interactions, TEs cause firing mouse events, through gestures events from browser.
B. For PEs, we want to suppress mousedowns etc on preventDefaulted pointerdowns.


Currently we achieve B by suppressing TEs (individual TouchPoints to be precise), through TouchInfo.consumed bit. This is a hack, causing this bug as well as  Issue 507408  &  Issue 607588 .

Replacing C with the suggestion in comment #4 above seems to solve all these problems.

Comment 6 by mustaq@chromium.org, Apr 28 2016

Edge doesn't fire mouse* events in this case, neither on Surface nor on Phone.
Project Member

Comment 7 by bugdroid1@chromium.org, Jun 16 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1904837ebb6f8f352572e0f833e14640a0db6d54

commit 1904837ebb6f8f352572e0f833e14640a0db6d54
Author: mustaq <mustaq@chromium.org>
Date: Thu Jun 16 21:39:32 2016

Suppressed MEs for gestures from cancelled PEs

Our current implementation suppresses the touch-points
for which the pointerevents have been canceled, to mimic
the ME suppression behavior of PointerEvents. In Edge,
however, TEs are fired as-is without considering the
canceling status of pointerdowns. We need to follow the
Edge behavior here for better web-compat.

Moreover, since preventing a pointerdown suppresses MEs,
this should be true for the MEs from gestures that are
ultimately triggered by TEs, when the PEs corresponding
to the TEs are canceled ( crbug.com/606938 ).

In addition, the current implementation (suppressing
touch-points for canceled pointerevents) has a few bad
side-effects:
- TE sequence can become inconsistent (eg touchend w/o
toushstart) for certain sequences of PE canceling
( crbug.com/607588 ).
- Preventing all PEs completely hides TEs but until touch
scroll starts, which suppresses PEs only to "reveal" the
hidden TE sequence from "middle" ( crbug.com/507408 ).

This CL adds a unique-touch-id queue in PointerEventManager
to properly suppress MEs from GestureTap, and makes TE
firing independent of PE handling in JS. This CL also
suppresses some default behavior associated with a
tap on canceled pointerdowns (e.g. focusing an input
field).

The MEs from GestureLongPress are left as-is in this CL
because suppressing them could break drag-drop; this will
be done separately in a follow-up CL.

BUG= 606938 , 607588 , 507408 

Review-Url: https://codereview.chromium.org/1989623002
Cr-Commit-Position: refs/heads/master@{#400264}

[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/components/test_runner/event_sender.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/components/test_runner/event_sender.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/content/browser/renderer_host/input/web_input_event_util_unittest.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/content/browser/renderer_host/ui_events_helper.cc
[add] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse-expected.txt
[add] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse.html
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-pointer-events-expected.txt
[add] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-pointer-mouse-expected.txt
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-pointercancel-expected.txt
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/core/input/EventHandler.cpp
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/core/input/EventHandler.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/core/input/PointerEventManager.cpp
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/core/input/PointerEventManager.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/core/input/TouchEventManager.cpp
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/core/input/TouchEventManager.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/platform/PlatformGestureEvent.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/platform/PlatformTouchEvent.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/web/WebInputEvent.cpp
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/web/WebInputEventConversion.cpp
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/third_party/WebKit/public/web/WebInputEvent.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/blink/blink_event_util.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/blink/blink_event_util.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/blink/blink_event_util_unittest.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/event.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/event.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gesture_detection/gesture_event_data.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gesture_detection/gesture_event_data.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gesture_detection/gesture_event_data_packet.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gesture_detection/gesture_event_data_packet.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gesture_detection/gesture_event_data_packet_unittest.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gesture_detection/gesture_provider.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gesture_detection/touch_disposition_gesture_filter.h
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gestures/gesture_provider_aura.cc
[modify] https://crrev.com/1904837ebb6f8f352572e0f833e14640a0db6d54/ui/events/gestures/gesture_provider_aura.h

Comment 8 by mustaq@chromium.org, Jun 17 2016

Summary: Suppress mouse events on tap & long press when pointerdown is consumed (was: Suppress mouse events on tap when pointerdown is consumed?)
Still to do: long press.

Comment 9 by mustaq@chromium.org, Jun 29 2016

Blocking: -471824
Labels: PointerEvent
Adding "PointerEvent" label to bugs that doesn't really block enabling behind experimental flag.
Started looking into the long-press case. It seems to me that in this case suppressing /all/ mouse events (on a canceled pointerdown) shouldn't hurt because there is no agreement between browsers even for existing mouse-events-for-touch case, see  crbug.com/485290#c1 .
Project Member

Comment 11 by bugdroid1@chromium.org, Jul 20 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/326934c3dd341e43ecaa2c05fbf7597f7c21764d

commit 326934c3dd341e43ecaa2c05fbf7597f7c21764d
Author: mustaq <mustaq@chromium.org>
Date: Wed Jul 20 20:17:01 2016

PointerEvents for long-press: fix double firing & canceling MEs

This CL fixes two bugs related to PointerEvents and gesture long
presses:

A. We fire pointer events from touch events. Gesture long-press
handler was calling handleMousePressEvent, which caused firing
of additional pointer events for the same touch sequence. This
CL skips firing PEs from PlatformMouseEvents synthesized from
touch.

B. Canceling a pointerdown should suppress all following
MouseEvents, including those fires through touch-gestures. We
have fixed the GestureTap case before. This CL fixes the only
remaining ME case: MEs from gesture long-press.

BUG= 627207 , 606938 

Review-Url: https://codereview.chromium.org/2141993003
Cr-Commit-Position: refs/heads/master@{#406649}

[modify] https://crrev.com/326934c3dd341e43ecaa2c05fbf7597f7c21764d/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-chorded-buttons.html
[add] https://crrev.com/326934c3dd341e43ecaa2c05fbf7597f7c21764d/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-long-press.html
[modify] https://crrev.com/326934c3dd341e43ecaa2c05fbf7597f7c21764d/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse-expected.txt
[modify] https://crrev.com/326934c3dd341e43ecaa2c05fbf7597f7c21764d/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse.html
[modify] https://crrev.com/326934c3dd341e43ecaa2c05fbf7597f7c21764d/third_party/WebKit/Source/core/input/EventHandler.cpp
[modify] https://crrev.com/326934c3dd341e43ecaa2c05fbf7597f7c21764d/third_party/WebKit/Source/core/input/EventHandler.h
[modify] https://crrev.com/326934c3dd341e43ecaa2c05fbf7597f7c21764d/third_party/WebKit/Source/core/input/GestureManager.cpp
[modify] https://crrev.com/326934c3dd341e43ecaa2c05fbf7597f7c21764d/third_party/WebKit/Source/core/input/GestureManager.h

Status: Fixed (was: Assigned)

Sign in to add a comment