CSSOM View Module Spec overrides the definition of UI MouseEvent to have fractional coordinates for screen, client, page & offset:
http://dev.w3.org/csswg/cssom-view/#extensions-to-the-mouseevent-interface
The current implementation is a bit of a mess:
- MouseRelatedEvent defines screen coordinate as integers but client & page coordinates as floats (as LayoutPoints).
- None of the floating point coordinates are exposed to JS. They are truncated either on object initialization (through IntPoints etc) or on property access.
- Even though the fractions in LayoutPoints are not exposed, the value limits are still exposed, see MAX/MIN_CLIENT_SIZE in mouse-event-constructor.html.
- Exposing stored LayoutPoint fractions doesn't feel great since the accuracy is 6-binary-digits after decimal (1/64). E.g. after crrev.com/2406263003,
new MouseEvent('eventType', { clientX: 123.45 }).clientX
produces 123.4375 because that's the closest possible through LayoutUnits.
The only sensible solution seems to be changing all these coordinates to floats and store them as FloatPoints. Ideally hittest code would switch to LayoutPoints on-the-fly, so layout code should be unaffected. Also this assumes that no back-and-forth is needed in some non-trivial case.
Comment 1 by dtapu...@chromium.org
, Oct 31 2016