Contact emails
Spec
CSSOM View Module extension to MouseEvents: https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
For PointerEvent which inherits MouseEvent, the community group reached consensus here: https://github.com/w3c/pointerevents/issues/107
Summary
Update the types of all coordinates in MouseEvents from long to double to make the coordinates more precise for PointerEvents on high-DPI devices.
Motivation
We updated TouchEvent coordinates few years ago to report fractional CSS px units, to avoid possible loss in precision (caused by truncating to integers) particularly in modern mobile hardware where multiple device pixels correspond to one CSS px unit. Around that time we deprioritized a similar update in MouseEvents because of the lack of a clear benefit:
https://lists.w3.org/Archives/Public/www-style/2015Feb/0193.html
Now that we are shipping PointerEvents (in M55) which is speced through a healthy collaboration of most major browsers, the benefit to update MouseEvents is now obvious: PointerEvents would inherit the fractional coordinates in MouseEvents, and web developers would be able to migrate from TouchEvents to PointerEvents without any precision loss in coordinates. The PointerEvents CG recently reached consensus about it.
Interoperability and Compatibility Risk
Since JavaScript represents both longs and doubles as Numbers, most existing code should work fine (and even show immediate smoothness benefits in typical coding patterns). There is a slight risk of breakages for the following hypothetical use cases:
A. Code that relies on exact comparison of (integer) coordinates, or uses coordinates as array indices.
B. Code that constructs MouseEvents in JS with fractional coordinates yet expects truncated values (e.g. expects “new MouseEvent('mousemove', {clientX: 1.5}).clientX” to be 1 instead of 1.5).
If we encounter significant breakages, we can alternatively truncate the coordinates in all browser-fired MouseEvents to integers while maintaining fractional coordinates in all PointerEvents. Edge currently follows this approach.
Ongoing technical constraints
None.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes.
OWP launch tracking bug
Link to feature dashboard entry
https://www.chromestatus.com/feature/6169687914184704
Requesting approval to ship?
Yes.
This should also hopefully increase resolution while under Pointer Lock, which was one of the earlier pointer lock requests that was difficult to practically satisfy.On Fri, Oct 28, 2016 at 8:02 AM, Mustaq Ahmed <mus...@chromium.org> wrote:Contact emails
Spec
CSSOM View Module extension to MouseEvents: https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
For PointerEvent which inherits MouseEvent, the community group reached consensus here: https://github.com/w3c/pointerevents/issues/107
Summary
Update the types of all coordinates in MouseEvents from long to double to make the coordinates more precise for PointerEvents on high-DPI devices.
Motivation
We updated TouchEvent coordinates few years ago to report fractional CSS px units, to avoid possible loss in precision (caused by truncating to integers) particularly in modern mobile hardware where multiple device pixels correspond to one CSS px unit. Around that time we deprioritized a similar update in MouseEvents because of the lack of a clear benefit:
https://lists.w3.org/Archives/Public/www-style/2015Feb/0193.html
Now that we are shipping PointerEvents (in M55) which is speced through a healthy collaboration of most major browsers, the benefit to update MouseEvents is now obvious: PointerEvents would inherit the fractional coordinates in MouseEvents, and web developers would be able to migrate from TouchEvents to PointerEvents without any precision loss in coordinates. The PointerEvents CG recently reached consensus about it.
Interoperability and Compatibility Risk
Since JavaScript represents both longs and doubles as Numbers, most existing code should work fine (and even show immediate smoothness benefits in typical coding patterns). There is a slight risk of breakages for the following hypothetical use cases:
A. Code that relies on exact comparison of (integer) coordinates, or uses coordinates as array indices.
B. Code that constructs MouseEvents in JS with fractional coordinates yet expects truncated values (e.g. expects “new MouseEvent('mousemove', {clientX: 1.5}).clientX” to be 1 instead of 1.5).
If we encounter significant breakages, we can alternatively truncate the coordinates in all browser-fired MouseEvents to integers while maintaining fractional coordinates in all PointerEvents. Edge currently follows this approach.
This should also hopefully increase resolution while under Pointer Lock, which was one of the earlier pointer lock requests that was difficult to practically satisfy.
Interoperability and Compatibility Risk
Since JavaScript represents both longs and doubles as Numbers, most existing code should work fine (and even show immediate smoothness benefits in typical coding patterns). There is a slight risk of breakages for the following hypothetical use cases:
A. Code that relies on exact comparison of (integer) coordinates, or uses coordinates as array indices.
B. Code that constructs MouseEvents in JS with fractional coordinates yet expects truncated values (e.g. expects “new MouseEvent('mousemove', {clientX: 1.5}).clientX” to be 1 instead of 1.5).
2) Pointer events with pointerType=touch
No, PointerEvent coordinates in Edge are fractional for all pointer types.
So, Rick, why would you suggest that only pointerType=touch will have fractional coordinates?
As per the above discussion, the intent will include the following changes (and non-changes):- PointerEvents of type touch: We will expose fractional coordinates in M56 since this would ease migrating from TouchEvents to PointerEvents for any use case that needs high-precision.- PointerEvents of type mouse: We will defer fractional coordinates for now only because of the amount of work involved. We want to do it in future to match Edge but it's not our priority for M56.- MouseEvents, WheelEvents, DragEvents, PointerLock: We will minimize risks by not changing anything for the events we fire, i.e., all fired events will have integer coordinates. (We will try to switch to fractional coordinates in future through a separate intent/CL plus some compat analysis as Rick suggested above. The only visible change will be the events (a) created in JS through event constructors & not through the init*() methods, AND (b) with fractional coordinates in *Init parameters---this is a rare case with very little risk.
Do I need anything else here?
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.