8000 [cssom-view] No (easy) way to access the viewport size without losing precision. · Issue #5260 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

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

@emilio

Description

@emilio

Related to #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, 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 doubles.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Unsorted

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0