Closed Bug 2071024 Opened 17 days ago Closed 4 days ago

[macOS] Coalesced `pointerrawupdate` events report movementX/Y = 0 during pointer lock while the dispatched event carries the correct delta

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

Firefox 155
defect

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox-esr153 --- affected
firefox156 --- wontfix
firefox157 --- wontfix
firefox158 --- fixed

People

(Reporter: jbedwell, Assigned: edgar)

References

(Regression)

Details

(Keywords: regression)

Attachments

(5 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36

Steps to reproduce:

  1. Open the attached test page on macOS
  2. Click the blue area to enter pointer lock
  3. Move the cursor continuously

This page shows a red cursor driven by dispatched events when the coalesced list is broken and a blue one driven strictly by the coalesced entries.

Actual results:

Observe the red cursor deviate from the blue cursor.

During pointer lock dispatched pointerrawupdate events report correct non-zero movement X/Y, but coalesced entries report movement X/Y = 0. The test page flags these as broken events. This reproduces in adjusted and unadjusted pointer lock modes.

Expected results:

Each coalesced pointerrawupdate entry reports movement X/Y which is equal to the sum of the coalesced event movements. Both cursors track the mouse, test page reports OK.

On macOS with pointer lock active, every entry returned by getCoalescedEvents() for a pointerrawupdate event reports movementX and movementY = 0, while the dispatched pointerrawupdate event itself reports the correct non-zero movement delta. The pointerrawupdate event movement delta should equal the sum of the movement delta of its coalesced events.

This affects applications that consume high frequency mouse input via pointerrawupdate + getCoalescedEvents() during pointer lock on macOS.

This appears to be the same class of issue as bugs 1829401 and 1987671 which concerned movement on the dispatched parent event. Based on https://github.com/w3c/pointerevents/issues/535 and behavior on Windows it appears that the behavior observed in this bug is not intended.

Testing done on macOS 26.6.2 + Firefox 155.0.0 / 155.0.1.

Yes, this looks like a bug to me, I will take a look.

Severity: -- → S3
Flags: needinfo?(echen)

:edgar, is Bug 2036482 potentially the regressor here?

Yes, I think so, I could not reproduce this after setting dom.pointer-lock.native-lock.enabled to false.

Keywords: regression
Regressed by: 2036482

The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.

Status: UNCONFIRMED → NEW
Ever confirmed: true

(In reply to Edgar Chen [:edgar] from comment #5)

Yes, I think so, I could not reproduce this after setting dom.pointer-lock.native-lock.enabled to false.

BTW, I see the same behavior on Linux, but setting dom.pointer-lock.native-lock.enabled to false doesn't help.
So it might be different root cause on Linux.


Edited:
Linux Wayland doesn't use that pref at all.

Assignee: nobody → echen
Flags: needinfo?(echen)

ePointerRawUpdate never has coalesced widget events to report, so
EnsureFillingCoalescedEvents() synthesizes a single entry from the dispatched
event via InitCoalescedEventFromPointerEvent(), which copied every member but
mMovement.

movementX and movementY are optional and have to be specified together.

Attachment #9644762 - Attachment description: WIP: Bug 2071024 - Support synthesizing mouse event with movement delta; → WIP: Bug 2071024 - Part 1: Support synthesizing mouse event with movement delta;

The expected result for coalesced event is based on current behavior, which may
be incorrect and will be fixed in subsequent patches.

Attachment #9644099 - Attachment description: WIP: Bug 2071024 - Propagate mMovement to the synthesized coalesced pointer event; → WIP: Bug 2071024 - Part 3: Propagate mMovement to the synthesized coalesced pointer event;

CanCoalesce() incorrectly required the movement deltas of both events to be
equal, so mousemove events carrying movement deltas were effectively never
coalesced.

Attachment #9646451 - Attachment description: WIP: Bug 2071024 - Part 2: Add test for movementX/Y during pointer lock; → WIP: Bug 2071024 - Part 2: Add test for movementX/Y during pointer lock;
Attachment #9644762 - Attachment description: WIP: Bug 2071024 - Part 1: Support synthesizing mouse event with movement delta; → Bug 2071024 - Part 1: Support synthesizing mouse event with movement delta; r?smaug
Attachment #9646451 - Attachment description: WIP: Bug 2071024 - Part 2: Add test for movementX/Y during pointer lock; → Bug 2071024 - Part 2: Add test for movementX/Y during pointer lock; r?smaug
Attachment #9644099 - Attachment description: WIP: Bug 2071024 - Part 3: Propagate mMovement to the synthesized coalesced pointer event; → Bug 2071024 - Part 3: Propagate mMovement to the coalesced pointer event; r?smaug
Attachment #9646459 - Attachment description: WIP: Bug 2071024 - Part 4: Allow mousemove events that carry movement deltas to be coalesced; → Bug 2071024 - Part 4: Allow mousemove events that carry movement deltas to be coalesced; r?smaug
QA Whiteboard: [qa-triage-done-c159/b158]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: