Open Bug 1947439 Opened 26 days ago Updated 12 days ago

RFP new window size is off because of roundings on partial values

Categories

(Core :: Window Management, defect)

defect

Tracking

()

People

(Reporter: pierov, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

STR:

  1. enable privacy.resistFingerprinting
  2. set system scaling to 1.25 (other scales might have slightly different results)
  3. open Firefox
  4. open the inspector, and notice the inner window width is 1399.2 CSS px rather than the expected 1400 CSS px. If LB is enabled, margins will be visible (in particular, the screenshot has the patches for Bug 1556016 applied)

Expected result: a window whose width is 1400 CSS px also when scaling is used.

Other configuration have problems with height rather than width (or maybe both).

I tried to debug and understand the cause.
nsContentUtils::CalcRoundedWindowSizeForResistingFingerprinting correctly returns a target width of 1750 dev px.
Then, the combination of AppWindow::SetPrimaryContentSize and AppWindow::SizeShellToWithLimit adds an offset of 17 dev px, given by the difference of the current window size and the shell width.

I think these 17px are wrong because partial values are rounded. I checked this stack trace:

xul.dll!mozilla::dom::Element::ClientHeight() Line 1586
	at C:\mozilla-source\mozilla-unified\obj-x86_64-pc-windows-msvc\dist\include\mozilla\dom\Element.h(1586)
xul.dll!mozilla::AppWindow::GetPrimaryRemoteTabSize(int * aWidth, int * aHeight) Line 2106
	at C:\mozilla-source\mozilla-unified\xpfe\appshell\AppWindow.cpp(2106)
xul.dll!mozilla::AppWindow::GetPrimaryContentSize(int * aWidth, int * aHeight) Line 2092
	at C:\mozilla-source\mozilla-unified\xpfe\appshell\AppWindow.cpp(2092)

In particular, on my VM (1920x1080 resolution with 1.25 scaling):

Notice that this should help to fix the behavior on Windows, that has different inner and outer sizes.
Currently there's some bug on Linux as well, but I think it's due to some bad rounding in GTK.

The severity field is not set for this bug.
:enndeakin, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(enndeakin)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: