Intent to change: Enable synthetic mousemove on Android to dispatch mouse/pointer boundary events at a layout change or a scroll

249 views
Skip to first unread message

Masayuki Nakano

unread,
Jun 4, 2025, 9:55:06 PMJun 4
to dev-pl...@mozilla.org, Olli Pettay, Hsin-Yi Tsai, Hiroyuki Ikezoe, Makoto Kato

Summary: We've not dispatched mouse/pointer boundary events at the last mouse cursor position when a layout change or a scroll occurs on Android. So, I'd like to enable this behavior on Android for conforming to current Pointer Events.

Details: We're dispatching an internal synthetic `mousemove` when a layout change or a scroll occurs but not exposed to the web. Then, it triggers the default handlers of `mousemove`, so, mouse boundary events and pointer boundary events may be fired if and only if the element at the last mouse cursor position is changed. And also the `:hover` state is changed to the element. However, this has been disabled on Android because after swiping the page to scroll, the synthetic `mousemove` will be fired at originally touched point and an element which is moved at the point will get `:hover` state. So, in the touch input case, keeping storing the last touch point is odd in some cases.

I realized that when APZC starts handling a gesture of a touch, APZC synthesizes a `pointercancel`. So, if `PresShell` starts handling `ePointerCanel` or `ePointUp` caused by touch input device, `PresShell` should forget the last mouse cursor position if and only if the position is caused by another touch input. Then, synthetic `mousemove` won't be fired after the touch is released or canceled by a gesture.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1633450

Specification: https://w3c.github.io/pointerevents/#boundary-events-caused-by-layout-changes

Platform Coverage: All (We've already enabled in desktop, but now enabled on Android too)

Preference: layout.reflow.synthMouseMove

Web-platform tests: https://wpt.fyi/results/pointerevents/pointerevent_pointerout_no_pointer_movement.html?label=master&label=experimental&aligned

NOTE: This is a risky change but we should fix this before mobile OSes would be used in wpt.fyi. So, please file regressions if you find.

-- 
Masayuki Nakano <masa...@d-toybox.com>
Working on DOM, Events, editor and IME handling for Gecko
Reply all
Reply to author
Forward
0 new messages