mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
`MouseEvent.pointerId` is `undefined` so that `setPointerCapture(undefined)` means `setPointerCapture(0)` and it captures both click of mouse and first touch of touch input devices. It needs to listen to `pointerdown` event to get the correct `pointerId` value. Then, it can use only `pointerdown` and `pointerup` because they are fired before `mousedown` and `mouseup`. Additionally, it handles a drag while a mouse button is pressed. Therefore, it can ignore pointer events which are caused by other devices. Although it's not required explicitly to release the capture when the pointer is up, it needs to release capturing the pointer if `Escape` is pressed. Therefore, this patch keeps the explicit release call. Depends on D217216 Differential Revision: https://phabricator.services.mozilla.com/D217217