Closed Bug 1544966 Opened 5 months ago Closed 5 months ago

pointer events are cancelled even with touch-action: none on a scrollable page

Categories

(Core :: Panning and Zooming, defect, P3)

x86_64
Windows 10
defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: timdream, Assigned: kats)

Details

Attachments

(4 files)

STR:

  1. On a touchscreen Windows device, like a Surface.
  2. Go to https://mdn.github.io/dom-examples/pointerevents/Pinch_zoom_gestures.html
  3. Make the page scrollable by doing |document.body.style.height = "120vh"|.
  4. Try to trigger pinch/zoom in the box.

Expected:

  1. It should work exactly as advertised.

Actual:

  1. Sometimes the pointer events will get cancelled for no reasons and the app will not be able to recognize the gesture.

Note:

  1. This won't happen, or happen less, when the page is not scrollable.
  2. I don't know if this happens on Firefox for Android or not but the page seems work fine if I turn on the responsive design mode. Although the page isn't exactly pannable on RDM.
  3. The demo is found on https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events/Pinch_zoom_gestures
Attached file page to test

The page on MDN with |height: 120vh| added.

Attachment #9058813 - Attachment mime type: text/plain → text/html

I can reproduce on Windows and Android (if dom.w3c_pointer_events.enabled=true). Basically if I go right into a pinch (both fingers down, then start moving) it doesn't work as expected. If I put one finger down, move it, then put the second finger down and move it, it does work. This seems to imply that APZ is detecting the first gesture as a pinch zoom and triggering pointercancel events when it's not supposed to (because the page has touch-action:none).

Priority: -- → P3

Initial investigation indicates that the APZ doesn't have the touch behaviours at the time of the pinch, so it defaults to allowing the pan-y action here.

This is kind of a silly thing: the layer tree and HitTestTreeNode instances have the right touch behaviours, but they only get sent to the InputQueue here which is a few lines after the ReceiveInputEvent that runs the ArePointerEventsConsumable function. So from an APZ behaviour point of view, the touch action flags are set on the input block in time, but the nsEventStatus return value is not as correct as it could be, which impacts pointer events.

A little plumbing should take care of this.

Assignee: nobody → kats

I have a fix, just need to write a test..

Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d3ab16a95b9c
Put the touch behavior flags on the TouchBlockState earlier. r=botond
https://hg.mozilla.org/integration/autoland/rev/51d8b82f8fbe
Don't schedule a main-thread wait if the APZCTM provided the touch behaviours already. r=botond
https://hg.mozilla.org/integration/autoland/rev/6c313c54c73b
Add a mochitest. r=botond
You need to log in before you can comment on or make changes to this bug.