Skip to content

Fix and backport Bugzilla 1873382 and 1929955: Multiply zoom by spoofed pixel ratio; Correct dPR calculation

Backport Patchset

Book-keeping

Bugzilla Issue(s)

Target Channels

  • Alpha
  • Stable
  • Legacy

Notes

problem:

  • currently breaks spec (lols) and a red flag since dPR (2) !== dpi (96) etc
    • at 100% zoom we report css/matchmedia etc as the zoom value as if dPR was 1
    • "-moz-device-pixel-ratio": 1 "-webkit-min-device-pixel-ratio": 1 "dpcm": 37.79527499999999 "dpi": 96.00000000000003 "dpi_css": 96 "dppx": 1

      • ^ and these all change when we zoom
    • but we report window.devicePixelRatio as 2
      • ^ and it does NOT change when we zoom, it is hardcoded

solution: fairly straightforward

  • change our css/mactmedia values to double (since our base spoof is 2)
  • multiply window.devicePixelRatio (which is 2) by zoom
  • then everything matches at any zoom level

cc: @fkilic @pierov

Edited by Pier Angelo Vendrame
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information