Open Bug 1807825 Opened 2 years ago Updated 2 years ago

Incorrect screen width/height (window.screen) in multi-monitor setup

Categories

(Core :: Widget: Cocoa, defect, P3)

Firefox 108
defect

Tracking

()

ASSIGNED
Tracking Status
firefox-esr102 --- wontfix
firefox108 --- wontfix
firefox109 --- wontfix
firefox110 --- fix-optional

People

(Reporter: mrksbnch, Assigned: spohl)

References

(Regression)

Details

(Keywords: regression)

Attachments

(4 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Firefox/108.0
Firefox for Android

Steps to reproduce:

I'm using two monitors and have them set up as follows:

  • MacBook Pro M1 13" (1440x900) as primary display
  • Secondary monitor (2560x1440) as secondary display
    The arrangement of these monitors in macOS (11.4) is as shown in the attached screenshot.

With the setup described above, the steps to reproduce are:

  1. Visit any webpage in Firefox
  2. Drag the Firefox window to the primary monitor and make it as big as possible. From what I can see, the same behavior also occurs for smaller window widths as long as the window is on the very right edge of the left (primary) monitor.
  3. Open the developer tools (console) and type window.screen

The exact same setup outputs the correct measurements in Chrome.

Actual results:

window.screen outputs:

Screen { availWidth: 1280, availHeight: 708, width: 1280, height: 720, colorDepth: 30, pixelDepth: 30, top: 0, left: 720, availTop: 13, availLeft: 720 }

Expected results:

window.screen outputs:

Screen { availWidth: 1440, availHeight: 875, width: 1440, height: 900, colorDepth: 30, pixelDepth: 30, top: 0, left: 0, availTop: 25, availLeft: 0 }

I see the values above if I resize the window width (to any width lower can around 1200px) and align it to the left side of the screen.

Since screen sizes are constant, resizing the window should not affect the screen size.

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Cocoa' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Cocoa
Product: Firefox → Core

Could you run mozregression to see if this is a regression? If you have never run mozregression before, simply run these three commands in a Terminal window:

sudo easy_install pip
sudo python3 -m pip install -U mozregression --ignore-installed
mozregression --good 2017-01-01

A number of Firefox versions will open in succession to narrow down when this started occurring. Simply type "good" or "bad" in Terminal based on whether or not a build reproduces the bug. Once finished, please post the output from the last run. It should give a last good and first bad revision as well as a link to look at the changesets in that range. Thank you!

Severity: -- → S3
Flags: needinfo?(bianchi.markus)
Priority: -- → P3

I just ran "mozregression" and did the same test for every version:

  1. Make the Firefox window that luckily always opened on my first monitor (the screen size reports correctly on my secondary monitor) fullscreen by holding the "option" key and clicking on the green "+" symbol in the upper left corner on macOS
  2. Open the Firefox devtools console
  3. Type "window.screen": If the width was reported as 1280, it was a bad build, if it reported as 1440 it was a good build

"mozregression" could narrow it down but seems to have been running into issues when trying to get the mozilla-central builds between the two revisions. You can find the output of the last two runs below. If you need any other information, please let me know.

10:37.07 INFO: Using local file: /var/folders/0_/cbhyb8yn5s3b4sk05z5fsgp80000gn/T/tmpz57wn_t3/2017-03-26--mozilla-central--firefox-55.0a1.en-US.mac.dmg (downloaded in background)
10:37.07 INFO: Running mozilla-central build for 2017-03-26
10:46.09 INFO: Launching /private/var/folders/0_/cbhyb8yn5s3b4sk05z5fsgp80000gn/T/tmpi3qqpv3e/FirefoxNightly.app/Contents/MacOS/firefox
10:46.09 INFO: Application command: /private/var/folders/0_/cbhyb8yn5s3b4sk05z5fsgp80000gn/T/tmpi3qqpv3e/FirefoxNightly.app/Contents/MacOS/firefox -foreground -profile /var/folders/0_/cbhyb8yn5s3b4sk05z5fsgp80000gn/T/tmpq8kzc1do.mozrunner
10:46.11 INFO: application_buildid: 20170326030204
10:46.11 INFO: application_changeset: f5e214144799889e2408c4841351f4053f00544e
10:46.11 INFO: application_name: Firefox
10:46.11 INFO: application_repository: https://hg.mozilla.org/mozilla-central
10:46.11 INFO: application_version: 55.0a1
Was this nightly build good, bad, or broken? (type 'good', 'bad', 'skip', 'retry', 'back' or 'exit' and press Enter): good
11:17.52 INFO: Narrowed nightly regression window from [2017-03-24, 2017-03-28] (4 days) to [2017-03-26, 2017-03-28] (2 days) (~1 steps left)
11:17.52 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=f5e214144799889e2408c4841351f4053f00544e&tochange=0e0eb96528a1d032fe6ed54f67d32290d533fbfd

11:17.52 INFO: Using local file: /var/folders/0_/cbhyb8yn5s3b4sk05z5fsgp80000gn/T/tmpz57wn_t3/2017-03-27--mozilla-central--firefox-55.0a1.en-US.mac.dmg (downloaded in background)
11:17.52 INFO: Running mozilla-central build for 2017-03-27
11:26.55 INFO: Launching /private/var/folders/0_/cbhyb8yn5s3b4sk05z5fsgp80000gn/T/tmps1cmfwi6/FirefoxNightly.app/Contents/MacOS/firefox
11:26.55 INFO: Application command: /private/var/folders/0_/cbhyb8yn5s3b4sk05z5fsgp80000gn/T/tmps1cmfwi6/FirefoxNightly.app/Contents/MacOS/firefox -foreground -profile /var/folders/0_/cbhyb8yn5s3b4sk05z5fsgp80000gn/T/tmp6etn1hpz.mozrunner
11:26.56 INFO: application_buildid: 20170327030203
11:26.56 INFO: application_changeset: cc53710589fb500610495da5258b7b9221edf681
11:26.56 INFO: application_name: Firefox
11:26.56 INFO: application_repository: https://hg.mozilla.org/mozilla-central
11:26.56 INFO: application_version: 55.0a1
Was this nightly build good, bad, or broken? (type 'good', 'bad', 'skip', 'retry', 'back' or 'exit' and press Enter): good
12:09.10 INFO: Narrowed nightly regression window from [2017-03-26, 2017-03-28] (2 days) to [2017-03-27, 2017-03-28] (1 days) (~0 steps left)
12:09.11 INFO: Got as far as we can go bisecting nightlies...
12:09.11 INFO: Last good revision: cc53710589fb500610495da5258b7b9221edf681 (2017-03-27)
12:09.11 INFO: First bad revision: 0e0eb96528a1d032fe6ed54f67d32290d533fbfd (2017-03-28)
12:09.11 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=cc53710589fb500610495da5258b7b9221edf681&tochange=0e0eb96528a1d032fe6ed54f67d32290d533fbfd

12:09.11 INFO: Switching bisection method to taskcluster
12:09.11 INFO: Getting mozilla-central builds between cc53710589fb500610495da5258b7b9221edf681 and 0e0eb96528a1d032fe6ed54f67d32290d533fbfd
12:11.22 WARNING: Skipping build cc53710589fb: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.cc53710589fb500610495da5258b7b9221edf681.firefox.macosx64-opt'
12:11.25 WARNING: Skipping build 0e0eb96528a1: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.0e0eb96528a1d032fe6ed54f67d32290d533fbfd.firefox.macosx64-opt'
12:12.64 WARNING: Skipping build d57834d60548: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.d57834d60548d3003d8c0725e7b0f103c1346da3.firefox.macosx64-opt'
12:12.64 WARNING: Skipping build 1c0b16d1747c: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.1c0b16d1747c0964577a8ec21fa2b0a17b44ea4e.firefox.macosx64-opt'
12:12.64 WARNING: Skipping build f5e214144799: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.f5e214144799889e2408c4841351f4053f00544e.firefox.macosx64-opt'
12:13.39 WARNING: Skipping build 2ecf610d3185: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.2ecf610d3185de940cb7b4ed2c214dc9e2367cee.firefox.macosx64-opt'
12:13.40 WARNING: Skipping build f9acfdca68a4: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.f9acfdca68a45c8cecf54f5a1bfc3b2a4baa52a3.firefox.macosx64-opt'
12:13.40 WARNING: Skipping build 65b0ac174753: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.65b0ac174753b22c01156d72fb42d2abd3176dd1.firefox.macosx64-opt'
12:14.14 WARNING: Skipping build 473e0b201761: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.473e0b20176139cff952b04e3eeff3ee155d0d3d.firefox.macosx64-opt'
12:14.15 WARNING: Skipping build 4c987b7ed54a: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.4c987b7ed54a630a7de76adcc2eb00dab49d5dfd.firefox.macosx64-opt'
12:14.16 WARNING: Skipping build 72bc265f157f: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.72bc265f157f3937f25d18be68b60fb982df695a.firefox.macosx64-opt'
12:14.90 WARNING: Skipping build 01d1dedf400d: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.01d1dedf400d4be413b1a0d48090dca7acf29637.firefox.macosx64-opt'
12:14.90 WARNING: Skipping build 65a83a84898e: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.65a83a84898ec3486aa36065d0f62f16c9a5b25d.firefox.macosx64-opt'
12:14.90 WARNING: Skipping build 200182ef1156: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.200182ef115692c4ed2909f1a8beae8a6f19d127.firefox.macosx64-opt'
12:15.64 WARNING: Skipping build fcfdeb52c2b2: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.fcfdeb52c2b2f020631fd47b5b02ea0be50d4027.firefox.macosx64-opt'
12:15.65 WARNING: Skipping build b0494b853b51: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.b0494b853b51c13deef16cb463cb30f3e4c0e1d0.firefox.macosx64-opt'
12:15.65 WARNING: Skipping build 439ee2e4fc4e: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.439ee2e4fc4ed4a82102608639d9751e376d5536.firefox.macosx64-opt'
12:16.39 WARNING: Skipping build 7513b3f42058: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.7513b3f42058e9bcf9950d4acf4647d4ad2240f0.firefox.macosx64-opt'
12:16.39 WARNING: Skipping build 2e95b7e18fcf: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.2e95b7e18fcf2b24844e484776c050e0d0c51e70.firefox.macosx64-opt'
12:16.39 WARNING: Skipping build 89b93d310da5: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.89b93d310da5bc7f86ebcdb8fe580d47a610757a.firefox.macosx64-opt'
12:17.13 WARNING: Skipping build e03e0c60462c: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.e03e0c60462c775c7558a1dc9d5cf2076c3cd1f9.firefox.macosx64-opt'
12:17.13 WARNING: Skipping build 08b46c736a62: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.08b46c736a62d3d572d67259420a093d564afd2e.firefox.macosx64-opt'
12:17.13 CRITICAL: First build cc53710589fb is missing, but mozregression can't find a build before - so it is excluded, but it could contain the regression!
12:18.36 WARNING: Skipping build e23cf1b38ad4: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.e23cf1b38ad4b55416318d205864195d3666b4f3.firefox.macosx64-opt'
12:18.39 WARNING: Skipping build c4392f466eaa: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.c4392f466eaab690d9b0ef7bacf72fa5e6573007.firefox.macosx64-opt'
12:18.39 WARNING: Skipping build 272ce6c25721: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.272ce6c2572164f5f6a9fba2a980ba9ccf50770c.firefox.macosx64-opt'
12:19.13 WARNING: Skipping build 6ea713ccc9ab: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.6ea713ccc9abea93126423fefb855d0e051c95e2.firefox.macosx64-opt'
12:19.14 WARNING: Skipping build fc2eda92be40: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.fc2eda92be4091d5ea0828f51fe4aaee41ed8319.firefox.macosx64-opt'
12:19.14 WARNING: Skipping build 4c7c05a49f3c: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.4c7c05a49f3ce40aa0969beccb397380a8907f4a.firefox.macosx64-opt'
12:19.89 WARNING: Skipping build 3364cc17988c: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.3364cc17988c013c36f2a8123315db2855393011.firefox.macosx64-opt'
12:19.89 WARNING: Skipping build 60d7a0496a36: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.60d7a0496a3673450ddbc37ec387525148c32604.firefox.macosx64-opt'
12:19.89 WARNING: Skipping build 03d602fd723a: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.03d602fd723ad6ff4588c04855884ffa1dee9410.firefox.macosx64-opt'
12:20.63 WARNING: Skipping build 8df9fabf2587: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.8df9fabf2587b7020889755acb9e75b664fe13cf.firefox.macosx64-opt'
12:20.64 WARNING: Skipping build b82d0e0dc533: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.b82d0e0dc5339e199cfd8e81718366dd77a7cdc2.firefox.macosx64-opt'
12:20.64 WARNING: Skipping build 0156a91a9fba: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.0156a91a9fbab5222c30a274e6d3477caf610074.firefox.macosx64-opt'
12:21.38 WARNING: Skipping build 13f5ae940c4e: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.13f5ae940c4eb099b987484885f9edf71ed0380b.firefox.macosx64-opt'
12:21.38 WARNING: Skipping build 5bd82c644e1f: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.5bd82c644e1fdc15b92ca9e34b31841151b44957.firefox.macosx64-opt'
12:21.38 WARNING: Skipping build 31810a9548fc: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.31810a9548fcede48be099fc9823fd2710616d64.firefox.macosx64-opt'
12:22.13 WARNING: Skipping build 00a166a8640d: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.00a166a8640dffa2e0f48650f966d75ca3c1836e.firefox.macosx64-opt'
12:22.14 WARNING: Skipping build 0d6ffde320ec: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.0d6ffde320ec3a3b44dc4c27f7c11cc9a9bf341c.firefox.macosx64-opt'
12:22.14 WARNING: Skipping build 7fe20a149f13: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.7fe20a149f135533746ecaa9a1cf99619101eae0.firefox.macosx64-opt'
12:22.86 WARNING: Skipping build f94c044dfb9b: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.f94c044dfb9b5c0bb0df326ed7a7ed804953f456.firefox.macosx64-opt'
12:22.86 WARNING: Skipping build 7bc9570270b3: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.7bc9570270b395dc53be1739391cc34b42d1b834.firefox.macosx64-opt'
12:22.86 CRITICAL: Last build 0e0eb96528a1 is missing, but mozregression can't find a build after - so it is excluded, but it could contain the regression!
12:23.60 WARNING: Skipping build a8bb5c8e0e80: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.a8bb5c8e0e80e87e21ad63997f8881991b5347cf.firefox.macosx64-opt'
12:23.60 WARNING: Skipping build d4af7ec6cfcd: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.d4af7ec6cfcd9b81cd1f433a00b412de61e95b62.firefox.macosx64-opt'
12:23.60 WARNING: Skipping build 7ac8812719a1: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.7ac8812719a11344a4cbcb5b1f6d55b5a68de0e6.firefox.macosx64-opt'
12:24.33 WARNING: Skipping build 5182b2c4b963: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.5182b2c4b963ed87d038c7d9a4021463917076cd.firefox.macosx64-opt'
12:24.34 WARNING: Skipping build bf0f89726139: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.bf0f897261395ed2488f8fef72cf5353da1e105e.firefox.macosx64-opt'
12:24.38 WARNING: Skipping build 9577ddeaafd8: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.9577ddeaafd85554c2a855f385a87472a089d5c0.firefox.macosx64-opt'
12:25.11 WARNING: Skipping build a6f35285bd1e: Unable to find build info using the taskcluster route 'gecko.v2.mozilla-central.shippable.revision.a6f35285bd1e674553527873614c55e0b7366bdb.firefox.macosx64-opt'
12:25.11 INFO: There are no build artifacts for these changesets (they are probably too old).
Flags: needinfo?(bianchi.markus)

It looks like bug 1194751 might have something to do with this, but I can't currently confirm this bug as I can't reproduce the issue. Is my understanding correct that your main monitor has a width of 1440 and your secondary monitor has a width of 1280? Or is the value of 1280 seemingly random? Does this reproduce if you rearrange the monitors at all in system settings, or by setting your external monitor as your primary monitor?

Flags: needinfo?(bianchi.markus)
Attached video Screen Recording

The width of 1280 are random. My primary monitor (MacBook Pro M1) has a width of 1440 and my secondary monitor has a width of 2560.

I also performed a couple of tests and I can only reproduce this issue with this specific configuration: My smaller monitor is the primary monitor and arranged as shown in the attached screenshot (to the top left corner of the secondary monitor). As soon as I make my bigger secondary monitor the primary one or rearrange the primary monitor (bottom left or right side of my secondary monitor), I can no longer reproduce this issue.

What I also noticed (and is also shown in the attached screen recording) is that the different width is not just reporting correctly/incorrectly when I resize the browser window but also when I resize the browser console.

Flags: needinfo?(bianchi.markus)

(In reply to Markus Bianchi [:mrksbnch] from comment #6)

The width of 1280 are random. My primary monitor (MacBook Pro M1) has a width of 1440 and my secondary monitor has a width of 2560.

It doesn't seem totally random, then; 1280 is half of 2560. The secondary monitor seems to be used at a 1x scale, so it's not correct to apply a 2x scale to its size. But I think Firefox applies the 2x conversion anyway because that's the window's scale, not the monitor's scale; and the window's scale is 2x because it's located on the primary screen.

So I think the bug is just that we pick the wrong screen.

I'm not sure how we decide which screen to use for a window. But I just found nsIWidget::GetWidgetScreen, which seems like a likely candidate, and it only has one implementation, in nsBaseWidget.cpp:

already_AddRefed<nsIScreen> nsBaseWidget::GetWidgetScreen() {
  nsCOMPtr<nsIScreenManager> screenManager;
  screenManager = do_GetService("@mozilla.org/gfx/screenmanager;1");
  if (!screenManager) {
    return nullptr;
  }

  LayoutDeviceIntRect bounds = GetScreenBounds();
  DesktopIntRect deskBounds = RoundedToInt(bounds / GetDesktopToDeviceScale());
  nsCOMPtr<nsIScreen> screen;
  screenManager->ScreenForRect(deskBounds.X(), deskBounds.Y(),
                               deskBounds.Width(), deskBounds.Height(),
                               getter_AddRefs(screen));
  return screen.forget();
}

So it detects the screen based on the window's rectangle. It would probably be better to override this method in nsCocoaWindow by calling -[NSWindow screen], i.e. asking macOS which screen it thinks the window is on.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Regressed by: 1194751

(I confirmed this bug because the screen recording looks very convincing.)

One system setting that might be related to this is the "Screen have separate spaces" setting. And maybe the window is just wide enough to extend into the secondary larger screen.

Set release status flags based on info from the regressing bug 1194751

(In reply to Markus Stange [:mstange] from comment #7)

It doesn't seem totally random, then; 1280 is half of 2560. The secondary monitor seems to be used at a 1x scale, so it's not correct to apply a 2x scale to its size. But I think Firefox applies the 2x conversion anyway because that's the window's scale, not the monitor's scale; and the window's scale is 2x because it's located on the primary screen.

So I think the bug is just that we pick the wrong screen.

Good point. The other incorrectly reported sizes do also suggest that Firefox thinks this window is on the second screen (and halves them as the external secondary monitor is in fact at 1x scale while the primary monitor is at 2x scale):

  • left is reported as 720 which is half of 1440 (the width of my primary MacBook monitor which is on the left of the secondary monitor)
  • height is also reported as 720 which is half of my external monitors height

(In reply to Markus Stange [:mstange] from comment #7)

[...]
So it detects the screen based on the window's rectangle. It would probably be better to override this method in nsCocoaWindow by calling -[NSWindow screen], i.e. asking macOS which screen it thinks the window is on.

It looks to me like the screen manager is queried for the screen for a particular rect that was previously "made" in MakeScreen, which does use -[NSWindow screen] indirectly via ScreenHelperCocoa::RefreshScreens. If I had to guess I'd say there is some kind of error due to the backing scale factor which causes ScreenManager::ScreenForRect to return the wrong screen, but I haven't been able to isolate this yet. We seem to look for the screen with the largest intersection with the window, which should prevent rounding errors from being a factor. I'll try to take another look today.

Assignee: nobody → spohl.mozilla.bugs
Status: NEW → ASSIGNED

So the source of this issue appears to be that we get an incorrect backing scale factor of 1.0f instead of 2.0f to compute deskBounds. This is because we appear to be using an instance of PuppetWidget to obtain the backing scale factor. This is confirmed by the following stack, which shows that we're using the base implementation nsBaseWidget::GetWidgetScreen instead of one of the platform overrides, such as nsCocoaWindow::GetDesktopToDeviceScale or nsChildView::GetDesktopToDeviceScale.

0   libmozglue.dylib              	       0x1005f7ebc mozalloc_abort + 68
1   libmozglue.dylib              	       0x1005f7ea8 mozalloc_abort + 48
2   libmozglue.dylib              	       0x1005f7ed8 abort + 20
3   XUL                           	       0x11204d32c nsBaseWidget::GetWidgetScreen() + 456
4   XUL                           	       0x10fee4b98 nsDeviceContext::ComputeFullAreaUsingScreen(nsRect*) + 80
5   XUL                           	       0x10fee4c78 nsDeviceContext::GetRect(nsRect&) + 44
6   XUL                           	       0x110495528 nsScreen::GetRect(mozilla::gfx::IntRectTyped<mozilla::CSSPixel>&) + 396
7   XUL                           	       0x11096184c mozilla::dom::Screen_Binding::get_top(JSContext*, JS::Handle<JSObject*>, void*, JSJitGetterCallArgs) + 184
8   XUL                           	       0x110eaaa1c bool mozilla::dom::binding_detail::GenericGetter<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) + 264
9   XUL                           	       0x1134293bc js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) + 608
10  XUL                           	       0x113429c04 js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) + 244
11  XUL                           	       0x11370c5d8 js::DebuggerObject::call(JSContext*, JS::Handle<js::DebuggerObject*>, JS::Handle<JS::Value>, JS::Handle<JS::GCVector<JS::Value, 0ul, js::TempAllocPolicy> >) + 1100
12  XUL                           	       0x11370bfb0 js::DebuggerObject::CallData::callMethod() + 336
13  XUL                           	       0x113715a24 bool js::DebuggerObject::CallData::ToNative<&(js::DebuggerObject::CallData::callMethod())>(JSContext*, unsigned int, JS::Value*) + 384
[...]

It isn't clear to me right now why we'd be using a PuppetWidget here. The only other widget implementation using the base implementation of GetDesktopToDeviceScale is HeadlessWidget.

Oh, interesting. PuppetWidget is the nsIWidget implementation that's used inside the content process. So this code must be running in the content process. I'm not sure how much of the true state we reflect into the content process.

Attachment #9310244 - Attachment description: Bug 1807825: Ensure that we detect the correct screen that a window is on, no matter the backing scale factor of a screen. r=mstange → Bug 1807825: Ensure that we detect the correct screen that a window is on, no matter the backing scale factor of a screen. r=mstange,emilio
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: