Different (smaller) window size after leaving fullscreen
Steps to reproduce:
- run latest MB
- open website with video, for example: https://svetserialu.io/serial/frasier/s03e09
- start video
- double click on played video to see it in fullscreen
- press ESC to leave fullscreen
- window size (its height) is smaller than before entering fullscreen.
The same behaviour is present even with: a) older versions of MB - I cannot remember since which version this bug is present. b) clean (new) profile.
BTW: latest Firefox 128 ESR with RFP & letterboxing enabled does not have this strange behaviour.
PS: Thanks for your hard work to bring browser privacy for masses.
Questions
- What is your operating system?
- Do you have a website example that we can use
- I can't use your example website - all videos cannot be played, I just get an error
Would also like some more information
- open MB
- open https://arkenfox.github.io/TZP/tzp.html in a tab and keep open
- what is the inner window size - mine is
1400 x 900 - what is the value of
[border] devicePixelRatio- mine is1 - in a new tab open the website: I choose https://www.youtube.com/watch?v=e-ORhEE9VVg (Taylor Swiftm go on you know you want to)
- make the video fullscreen
- escape fullscreen
- return to the TZP tab, what is the inner window size - mine is
1400 x 900
OS: Windows 10 21H2 x64
I followed your steps: my inner window size: 1400 x 700 my [border] devicePixelRatio: 1.25 inner window size stays the same after exiting fullscreen YT video - it is still 1400 x 700
Regarding my [border] devicePixelRatio value 1.25: This value has something to do with my OS settings "Scale and layout" set to "125%" on full HD resolution. MB "layout.css.devPixelsPerPx" is set to default value "-1.0"
website example: If I followed your steps on this site https://www.bombuj.si/online-film-pulp-fiction then inner window size is different - changed from 1400 x 700 to 1400 x 600 and also the whole (not just inner) MB window size (its height) is changed.
layout.css.devPixelsPerPx = -1.0 is correct, that's what you want
devicePixelRatio (dPR) is a combination of zoom and system scaling. Your system is 125% and the page is at 100% :)
when dPR is not an integer (like 1 on my desktop or 2 on my mac) it can produce what we call subpixels - and it all gets confusing with cssDevicePixels and floating points and what is being sized, e.g. fonts may size differently to elements. Suffice to say, it maskes things hard.
If I followed your steps on this site https://www.bombuj.si/online-film-pulp-fiction then inner window size is different - changed from 1400 x 700 to 1400 x 600 and also the whole (not just inner) MB window size (its height) is changed.
if you toggled privacy.resistFingerprinting.letterboxing to false after exiting the video, then we would see on the TZP tab that the inner window is something like 1400 x 699 - i.e 1 pixel out. make sure to toggle letterboxing back to true if you do this. This is due to subpixels and how we handle them (round, ceil, floor, truncate etc - it's complicated to say the least)
@PieroV has done some newwin [1] code fixups and cleanups recently, not sure if they have landed in stable yet - https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/43205 is one such issue
[1] newwin is what we call the code that sets the window size on creation - and the same algorithm is supposed to be used everywhere AFAIK - so if you opened your browser at 1400 x 700 but later it decided 1400 x 699 then that is an issue/bug.
notes to myself
- I wonder why youtube doesn't change but bobuj.si does (for OP)
over time newwin code has expanded to handle more cases than just creation of a new window - such as double clicking the matte to snap to LB size and other instances
https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/43205#note_3153515
-
Notice I double click for shrinking.
Letterboxing tries to resize to 1400x800, but instead it resizes to 1400x799.
Yikes.
Thanks for your prompt replies ;)
I did not change RFP and LB settings in MB - LB is (and always was) enabled in my MB. I also wonder why is MB inner (and also whole) window size (its height) changed from 700 to 600 pixels (not 699) only on some sites (bombuj.si, svetserialu.io etc ...).
To compare with new/clean profile on regular Firefox 128.8 ESR with Arkenfox user.js v128 applied - just 3 overrides added (RFP enabled + LB enabled + bookmark visibility set to never [to have MB gui look]) + uBO extension installed with default settings (NoScript not installed): as per TZP my inner window size is 1400 x 600 before entering fullscreen and my [border] devicePixelRatio is 1.25 If I followed your steps on mentioned site https://www.bombuj.si/online-film-pulp-fiction inner window size (and also the whole Firefox window size) stays the same after exiting fullscreen video - inner window size is still 1400 x 600, so I think there is a MB bug which changes inner (and also whole) window size (its height) after exiting fullscreen video on website bombuj.si
just FYI, when I freshly start browsers on TZP without video site (maybe this will help and maybe there is correlation with Windows 10 setting "Scale and layout" set to "125%" on full HD resolution or correlation with NoScript extension in MB): MB on TZP has 1400 x 700 without LB margins FF (with settings mentioned above) on TZP has 1400 x 600 with LB margins BTW: these browsers have the same window size when freshly started (I do not think inner window size, but whole window size)
@stano22 hi! Firefox's letterboxing code is (was) kinda different from our browsers (Tor Browser and Mullvad Browser). We worked to improve it, and we're still sending Mozilla patches. The most important one has been merged though, but I don't know if it reached current Firefox stable from the rapid release, it won't reach 128 for sure. As thorin said, I tried to improve the algorithm to create new windows, but I don't know if it's triggered also when exiting from fullscreen. My corrections work only when the first window is created. So, it'd be great to reproduce the problem in a simple webpage I could use to test and debug. And thank you for this reporting.
I opened https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/43591
changes inner (and also whole) window size
So .. I think I misunderstood a little. When you start the browser, it opens inner at 1400 x 700 and you don't see any letterboxing, right - i.e the entire inner window fills up with webpage content and you don't have a matte (or LBing background) on the top and bottom?
And then after you visit the video and fullscreen it and escape, the inner window is now at 1400 x 600 and you still don't see any letterboxing?
Can you clarify this?
Questions
- Is your windows taskbar on autohide?
- What is your
Bookmarks Toolbarset to? Right click in the tabstrip (where the tabs are) and selectBookmarks Toolbar- what is checked? Always show, never show, only show on new tabs? - What is your screen resolution?
- windows: Settings > System > Display > Display Resolution
Answers to your questions:
- no, Win taskbar is not on autohide - taskbar is always visible and fixed size
- Bookmark toolbar in MB is set to "never" (as I mentioned before)
- screen resolution is full HD 1920 x 1080 (as I mentioned before)
When I start MB, it opens inner at 1400 x 700 and I don't see any letterboxing - i.e. entire inner window is filled up with webpage content (it is best seen on TZP site) and I don't have any LB margins. After I visit the video (on bombuj.si) and fullscreen it and escape, the inner window is now at 1400 x 600 and it shows LB margin just on bottom (very minimal margin), no LB margin on top.
(as I mentioned before) (as I mentioned before)
my bad :)
After I visit the video (on bombuj.si) and fullscreen it and escape, the inner window is now at 1400 x 600 and it shows LB margin just on bottom (very minimal margin), no LB margin on top.
Hmm, I would have expected quite a bit since the LBing steps are 100px.
So at this point in the test (where you are at 1400 x 600), can you
- open
about:configin a new tab - click OK/continue if you see a warning
- type
letterboxingin the search field and toggleprivacy.resistFingerprinting.letterboxingtofalse -
- switch back to TZP and get the inner values
- switch back to about:config and reset
privacy.resistFingerprinting.letterboxing
This will tell us if you are out by 1 pixel or 99 pixels or anywhere in between
hi Thorin,
I followed your required steps and the result is:
- inner window size stays the same after disabling LB - i.e. 1400 x 600
- inner window size stays the same after re-enabling LB - i.e. 1400 x 600
- also the whole MB window is the same in both cases
BTW: are you able to reproduce my issue with links I provided?
OK, so IIUIC this means there is no subpixel issue, you're a whole 100px difference. That's weird.
Screen resolution - so 1920 x 1080 is your native resolution, and it's zoomed 125%. So you're effectively using 1536 x 864. So your new window on startup is 1400 x 700 - it fits within your available screen area (ie. without the 48'ish pixels used by the taskbar and the 100'ish pixels for the browser chrome).
However that is close to the using all the available height, and sounds like something (IDK what) is causing it to expand/trip over that slight margin and end up not able to fit 700px height so it steps down to 600px height. For example, just guessing - imagine if when you exit fullScreenElement, the bookmark toolbar height is added to the calculation and this is what causes it. - @PieroV - my gut instinct says this is what it is
To reproduce here I would have to tweak my max newwin sizes and chrome etc to get close to tripping a smaller window size. My monitors are 2560 x 1440 - so nope, haven't reproduced yet as I thought it would require subpixels (which I don't have on this machine)
I managed to reproduce only once (Windows VM, 125%, 1920x1080 resolution, Tor Browser 14.5a5). I'll try also on stable.
A strange thing happens when you dismiss the notification bar of the language the first time you run the app... But that isn't really related to fullscreen:
https://github.com/user-attachments/assets/86b42b89-e27f-4385-accb-2f8822a0b557
@ Thorin yes, 1920 x 1080 is my native resolution and it's zoomed 125% and new MB window on startup is 1400 x 700
@ Thorin, Piero I attach pixel exact images:
- before entering to fullscreen
- after exiting fullscreen video from website bombuj.si
As I mentioned before, the whole window size (not just inner size) is changed after exiting fullscreen: height changed from 982 pixels to 877 px
BTW inspite LB is enabled, LB margins are never present after fresh startup of MB, BUT there is one exception: after every update of MB and restarting to apply update (like today update to 14.0.8), there is one big LB margin at bottom (just at bottom, because I set Content alignment in MB to "Top"), but after second restarting of browser, there is again no LB margin - this strange behaviour happens only after MB update (i.e. the first MB startup after update).
BTW, thanks for persevering and providing lots of info :)
BTW inspite LB is enabled, LB margins are never present
newwin code is trying to get your inner window the exact right size so LBing margins do not show - so that's expected. LBing if enabled is still working, it's just "invisible" - if you manually resized the window it would kick in visually.
OK, so in the second pic there is some LBing showing. This is a side issue/symptom so we can ignore it, somewhat.
lemme do some number crunching for my own sake (wish I knew your taskbar height, but no big deal since piero reproduced)
pic 1: normal startup everything is good
- 1752 x 982 (image size)
- 1402 x 785 (at 125% scaling)
- 1400 x 700 inner
- 2 x 85 chrome
screen
- 1536 x 864 - normal 1402 x 785 = 134 (width) x 79 (height) left over
- 79 height left: taskbar height in windows 11 is 48px at 100% scaling for reference
- 79 - 48 = 21pixels left to spare (as an example, IDK the taskbar height)
- doesn't take much to trigger s step down: e.g. bookmarks toolbar will exceed 21 pixels
pic 2: exiting fullscreenElement
- 1752 x 877 (image size)
- 1402 x 702 (at 125% scaling)
- 1400 x 617 (minus 2 x 85 chrome)
- 17 pixels letterbox matte (on the bottom in this case)
pic 3 (subpixel: separate issue)
- 1752 x 981 (image size) <-- 1 pixel smaller than pic1 (subpixels!!!)
- 1402 x 784 (at 125% scaling) <-- pic 1 is 785.6, pic 3 is 784.8 = 0.8 or (1 pixel / 1.25)
cogito ergo sum - this means the letterbox matte in pic 3 is 99 pixels
one exception: after every update of MB and restarting to apply update
how do you restart? Is this via Help > About Mullvad Browser and the button that says Restart to update... ?
A strange thing happens when you dismiss the notification bar of the language the first time you run the app...
Hah. That looks exactly like dismissing the UX triggered the "double click to fit" code - this and DRM notifications in FF and the warning about "scripts are slowing down this page" and "refresh Firefox" prompt are about the only items to use this UX where it eats into the viewport, AFAIK: everything just gets pinned off the tabstrip.
14.0.9 used. On Windows I do scale only the text (Display->Make text bigger) to 125%.
Firefox - [border] devicePixelRatio - 1.25
MB - [border] devicePixelRatio - 1.0
How can I achieve the Firefox behavior?
@mnb21 your question is off-topic - in future please use a new issue. To answer your question once and only once in here: the answer is you can't - you changed a setting and it's fingerprintable - i.e measurable and not just in a the border PoC
@mnb21 Wait, this doesn't make sense. Where are you scaling text? If it's from the system Settings > Accessibility > Text Size then that should apply to both FF and MB
OK, I tested - TB/MB are different to FF - seems MB/TB block the system setting @PieroV I didn't know this, did you?
Here I change only the text scaling - https://ibb.co/6cTvh23r
yup, that's the same on win11 - IDK what version you're on but I'm win 11 pro with all updates, just a different settings UI - besides, I produced the same result as you so I knew it was the same thing :)
OK, I tested - TB/MB are different to FF - seems MB/TB block the system setting @PieroV I didn't know this, did you?
Yes. It's because you need a COM API to access that that isn't available on mingw. So, we ignore that settings in our browsers (even though I wanted to be sure it didn't influence the results also on upstream Firefox, hence the bug fkilic worked at a certain point on).
mingw
ahh yes .. mingw so many downsides but hey, found an upside :)
@ Thorin Regarding "LBing margins (do not) show": MB and TB are exactly the same browsers with some nuances (MB with webRTC enabled etc.), right? So how is it possible, that MB starts with window size 1752 x 982 (without LB margins), but TB starts with window size 1752 x 981 (and therefore with LB margins due to 1 pixel smaller window height). Both browsers should start with the same window size on the same device.
Regarding "how do I restart MB after update": It does not matter (if it is via Help > About Mullvad Browser or via the button that says Restart to update ...), result is still the same - windows size 1752 x 981 after every update of MB and restarting to apply update (i.e. the first MB startup after update).
TB and MB are identical except branding, tor, and a couple webRTC (99.99% sure that's it). We call this base browser
So how is it possible, that MB starts with window size 1752 x 982 (without LB margins), but TB starts with window size 1752 x 981
IDK. The MB size is actually 1402 x 785 which is correct because your chrome is 2 x 85, so you end up with an inner of 1400 x 700 and that exactly matches LBing steps and thus hides any annoying/distracting letterboxing margins around web content - so success!!!
I can't tell what TB is doing without any data
how do I restart MB
thanks