New issue
Advanced search Search tips

Issue 655786 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 456625
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug

Blocking:
issue 607948



Sign in to add a comment

All MouseEvent coordinates should be floating points

Project Member Reported by mustaq@chromium.org, Oct 13 2016

Issue description

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.

 
Blocking: 607948
Mergedinto: 456625
Status: Duplicate (was: Assigned)

Sign in to add a comment