Open Bug 1657380 Opened 4 years ago Updated 1 year ago

CSS screen.height seems wrong

Categories

(Core :: Layout, defect, P2)

Unspecified
All
defect

Tracking

()

People

(Reporter: snorp, Unassigned)

References

Details

According to the discussion here[1], we seem to be subtracting 16 pixels from the value returned from screen.height compared to other browsers.

[1] https://github.com/w3c/csswg-drafts/issues/5204

Severity: -- → S4
Priority: -- → P2
Whiteboard: [geckoview:m88]
Whiteboard: [geckoview:m88] → [geckoview:m89]
Whiteboard: [geckoview:m89] → [geckoview:m91]
Whiteboard: [geckoview:m91]

This seems to be rounding issue of int vs float/double.

nsDeviceContext::SetDPI calculates mAppUnitsPerDevPixelAtUnitFullZoom, it is int value, it causes rounding issue on some device.
When using Pixel 2, dpi density is 2.625. AppUnitsPerCSSPixel is 60, so 60 % 2.625 != 0.

When device pixel is 1920x1080 and dpi is 2.625,

Gecko: 1920 * mAppUnitsPerDevPixelAtUnitFullZoom (23) / 60 = 736px
Blink: 1920 / 2.625 = 731.428571429.. = 732px

What's owner of AppUnits rouding issue? gfx?, layout?

Also, I guess that window.devicePixelRatio doesn't equals to Blink's on Pixel 4a etc due to same rounding issue of nsPresContext.

Component: General → Layout
Product: GeckoView → Core
See Also: → 1818953
You need to log in before you can comment on or make changes to this bug.