w3c / w3c/csswg-drafts

[cssom-view] Need to define how fractional lengths are converted to integers.

Open
#5,259 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

cssom-view-1
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

There are various APIs in the OM which return integer sizes. Some of them:

  • Window.{inner,outer}{Width,Height}.
  • Window.screen{X,Y,Top,Left}.
  • Screen.avail{Width,Height}.
  • Screen.{width,height}.
  • Element.offset{Top,Left,Bottom,Right}.
  • Element.scroll{Width,Height}.

These return CSS pixels, and that means that in the current world of HiDPI screens and different screen resolutions, are all lossy.

Browsers do different things when converting these from fractional CSS pixels to an integer:

It seems ideally we should have interop. I think some (if not all) of these (specially window sizes) would benefit from returning doubles, will file an issue on this. But it seems some agreement on what to do here would be on point.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the listed CSSOM View APIs with the Gecko, WebKit, and Blink conversion behaviors described in the issue. The work is done when the relevant specifications define an interoperable conversion rule, or resolve whether affected APIs should return doubles instead.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.