[csswg-drafts] [cssom-view] No way to access the viewport size without losing precision. (#5260)

emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] No way to access the viewport size without losing precision. ==
Related to https://github.com/w3c/csswg-drafts/issues/5259.

I recently caused a compat issue in Firefox for making the layout viewport size more often a subpixel size. [Here are the gory details](https://bugzilla.mozilla.org/show_bug.cgi?id=1648265#c8), which amount basically to people making layout decisions based on `window.innerWidth`, `window.innerHeight` and so on. That seems a totally reasonable thing to do.

But turns out you can't do it in a sound way (the original page has issues in all browsers, just a different zoom levels / resolutions / etc). Well, I guess technically you can call `getBoundingClientRect()` on a `position: fixed; top: 0; left: 0; right: 0; bottom: 0` element, but that seems rather hackish.

So, I think we should either:

 * Make these APIs return `double`s.
 * If that's not possible because of compat (which would be a bit sad, but plausible), introduce a new API for this?

Is there any context I'm missing? If not and people agree that this is better than the status quo, I'd be happy to experiment with this in Firefox and see what the compat impact might be.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5260 using your GitHub account

Received on Thursday, 25 June 2020 00:18:00 UTC