gotpointercapture event should be a PointerEvent #269
Description
The gotpointercapture
event caused by element.setPointerCapture()
is currently a mere Event
. The test pointerevent_gotpointercapture_before_first_pointerevent-manual
expects a gotpointercapture
event to be a pointer event: https://github.com/w3c/web-platform-tests/blob/master/pointerevents/pointerevent_gotpointercapture_before_first_pointerevent-manual.html#L39.
It looks doable to create a PointerEvent
instead of an Event
. The trickier part is getting the properties of the pointer at the time of the execution of element.setPointerCapture()
, like pageX
and pageY
. Afaik, the only point where we store recent pointer events is dispatcher.pointermap
, which contains the most recent mousedown
event or particular touchstart
properties.
Introducing tracking of the most recent mousemove
and touchmove
would get us closer to the actual value. Generally I would say the most recent mousedown
\ touchstart
is close enough, since the most common use case of a capture is to capture the movement of a pointer starting from the moment the pointer is pressed.
Though if one creates something fancy like: "Only capture, if the pointer has been dragged for over 2 seconds" or "only capture, if the pointer left a certain element", using the most recent pointerdown
would be way off.
On the other hand, the setPointerCapture
event is asynchronous, so maybe we can be somewhat lax about its properties.