Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove long_to_double from MouseEvent API #11317

Merged
merged 1 commit into from
Jun 30, 2021

Conversation

queengooborg
Copy link
Contributor

This PR removes the various long_to_double entries from the MouseEvent API. Overall, the difference between a long and a double is more floating point accuracy, but I can't imagine a scenario where a web developer will require such high levels of precision, not to mention this is near impossible to test, and only really observable in the WebIDL.

@github-actions github-actions bot added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Jun 30, 2021
@foolip
Copy link
Contributor

foolip commented Jun 30, 2021

These entries are very poorly described, but are about this change I think:
https://chromestatus.com/feature/5117956774166528

(The versions don't match, so I'm not sure...)

https://chromestatus.com/feature/6169687914184704 is a similar change.

@queengooborg
Copy link
Contributor Author

I'm now realizing that I was seriously confusing long with float, and was thinking that long was a decimal format...oops. As such, I think we should keep it, but maybe give it a better name? (And maybe de-duplicate the entry, so we only have one long_to_double?)

@foolip
Copy link
Contributor

foolip commented Jun 30, 2021

Yeah, I think a single subfeature per interface where some members changed from always integer to sometimes floating point would be good. "fractional coordinates" is actually a pretty good description I think.

I see that https://chromestatus.com/feature/6169687914184704 says:

only browser-fired events that will change are PointerEvents. MouseEvents will continue to have integral coordinates for backward compatibility

If that's still true, then these entries on MouseEvent seems kind of pointless.

@foolip
Copy link
Contributor

foolip commented Jun 30, 2021

This all originates from the wiki table:
https://web.archive.org/web/20180421035120/https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent#Browser_compatibility

I'm pretty sure that the single "MouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, and MouseEvent.Y are double instead of long." feature there was based on https://chromestatus.com/feature/6169687914184704 and was then turned into multiple features when it was ported to BCD in #1883.

I've just tested in Chrome 91 to confirm that MouseEvent coordinates are still integers, while PointerEvent has fractional coordinates. In fact, even though MouseEvent does have some double members in Chromium's IDL, it doesn't seem possible to actually observe that, because those same getters floor the returned value to integers:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/events/mouse_event.h;l=138-146;drc=c629498025fa2b88f251047c22b06ca840c05f5e

A further nail in the coffin is that the spec uses long for these members:
https://w3c.github.io/uievents/#idl-mouseevent

@foolip foolip merged commit 98fb208 into mdn:main Jun 30, 2021
@foolip
Copy link
Contributor

foolip commented Jun 30, 2021

@ddbeck let me know if you need any more info for the release notes here, or if it seems suspect when you try to explain it.

@foolip
Copy link
Contributor

foolip commented Jun 30, 2021

Note also that the real change/feature is already represented here:
https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType#browser_compatibility

@foolip
Copy link
Contributor

foolip commented Jun 30, 2021

And I've sent #11327 to link bugs for that entry.

@queengooborg queengooborg deleted the api/MouseEvent/long_to_double branch June 30, 2021 18:27
ddbeck added a commit to ddbeck/browser-compat-data that referenced this pull request Jul 1, 2021
ddbeck added a commit that referenced this pull request Jul 1, 2021
* Bump version to v3.3.10

* Add release note for #10958

* Add release note for #11061

* Add release note for #11062

* Add release note for #11266

* Add release note for #11276

* Add release note for #11307

* Add release note for #11317

* Add release note for #11323

* Add release note for #11328

* Add release note for #11334

* Fix formatting

* Set release date

* Add stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants