Open Bug 1648298 Opened 4 years ago Updated 9 days ago

Don't round subpixel sizes up in CSSOM APIs.

Categories

(Core :: DOM: CSS Object Model, task, P3)

task

Tracking

()

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

Bug 1648265, caused by bug 1647356, exposed some interesting stuff.

At some places where we need to convert from CSS pixels to integers, like window.innerWidth / window.innerHeight, we're rounding, instead of truncating.

If websites use them to drive sizing decisions, like in that bug, this can cause undesired overflow at some zoom levels / resolutions.

I think ideally there should be two improvements:

  • These sizes should be precisely available as floats to script.
  • We shouldn't round up sizes like that when returning them to content.

It seems WebKit and Chromium (inheriting from WebKit, probably) truncates, unless you're really close to the next pixel (probably to account for floating point errors).

That seems somewhat hackish, but maybe reasonable?

Depends on: 1676843
No longer blocks: 1647356
See Also: → 1889244, 1647356
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: