subpixels: window/screen measurements via css/@media leak system scaling/dPR
upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=1672093
by leveraging "min" values we can expose subpixels. Subpixels can manifest in the topic items, but depends on a number of things... which we don't need to get into. For example, 133% system scaling is not going to compute integers but may at 300% zoom - ignore all this noise - it suffices to say that subpixels exist, a lot: think android for starters where I believe there is no such thing as a devicePixelRatio of 1
so
- css: pure css will round down, so gives away a binary difference [1]
- matchmedia: using a binary search (min/max) it will return a lower and upper bound: TZP returns the lower bound. This has decimal precision
This should be as simple as returning/using the non-min values when asking for said min values
- screen:
min-device-width
,min-device-height
-> usedevice-width
,device-height
- window:
min-width
,min-height
-> usewidth
,height
[1] I think, maybe needs a tweak, this (binary result) might also manifest when "square", but I'm not worried about that in this issue
@media (min-aspect-ratio:10000/9999){#cssAR:after{content:"landscape";}}
@media (max-aspect-ratio:9999/10000){#cssAR:after{content:"portrait";}}
@media (device-aspect-ratio:1/1){#cssDAR:after{content:"square";}}
@media (min-device-aspect-ratio:10000/9999){#cssDAR:after{content:"landscape";}}
@media (max-device-aspect-ratio:9999/10000){#cssDAR:after{content:"portrait";}}
cc: @pierov @cypherpunks1
Edited by Thorin