RFP: fixup square spoofed orientation
Categories
(Core :: CSS Parsing and Computation, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox133 | --- | fixed |
People
(Reporter: thorin, Assigned: fkilic)
Details
Attachments
(2 files)
In Bug 1607032 and Bug 1918202 we spoofed the orientation in JS to match CSS, but limited it to -primary and the angle at respectively 0 (landscape) or 90 (portrait) - based on our spoofed screen measurements = no entropy gained as we already give way the screen measurements
Unfortunately, I said to return landscape-primary when width and height match
The spec says (emphasis mine)
The orientation media feature is portrait when the value of the height media feature is greater than or equal to the value of the width media feature
So my bad. And now we can end up with landscape in JS and portrait in CSS - see attached image. Whilst this is still better than the previous hardcoded RFP landscape, and that square is unlikely a screen resolution (but can happen with RFP using inner), the chances are low that this will manifest, but it would be nice to clean up
| Reporter | ||
Comment 1•1 year ago
|
||
mismatched JS vs CSS when square
| Assignee | ||
Comment 2•1 year ago
|
||
Updated•1 year ago
|
Comment 4•1 year ago
|
||
| bugherder | ||
| Reporter | ||
Comment 5•1 year ago
|
||
verified fixed at least on desktop - I can't test on android because I can't get a square inner window
| Reporter | ||
Comment 6•1 year ago
•
|
||
found another quirk for returning "square" screens: https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/43215 - maybe emilio can shed some light
the css/matchMedia results can differ if I flip my display upside down (and I always restart FF between tests)
- somehow the decimal precision in a number of places changes e.g. in my case inner matchMedia from
1000.1640625 x 1000.1640625(= 1000 x 1000 rounded == screen) to1000.7265225 x 1000.1640625(= 1001 x 1000 rounded !== screen)
So .. I think with RFP enabled we need to floor the values used in the code to determine the orientation - and this should fixup all the css/matchMedia to match our spoofed screen sizes - somewhere lower (higher?) .. earlier... in the stack before anything needs to use it? we shouldn't floor things, my bad :) We should work out why flipping displays (e.g. landscape-primary to landscape-secondary) causes a different calculation
I'm also very intrigued as to why the decimal precision changed and if this could effect other subpixel measurements, e.g. in fonts, elements, widget sizes and so on.
Description
•