Closed Bug 1922204 Opened 1 year ago Closed 1 year ago

RFP: fixup square spoofed orientation

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
133 Branch
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

Attached image messy.png

mismatched JS vs CSS when square

Assignee: nobody → fkilic
Status: NEW → ASSIGNED
Pushed by fkilic@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/137f273d05f3 fixup square spoofed orientation. r=tjr
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch

verified fixed at least on desktop - I can't test on android because I can't get a square inner window

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) to 1000.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.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: