@@ -7518,37 +7518,53 @@ void nsGlobalWindowInner::SetReplaceableWindowCoord(
75187518 if (innerWidthSpecified || innerHeightSpecified || outerWidthSpecified ||
75197519 outerHeightSpecified) {
75207520 nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = outer->GetTreeOwnerWindow ();
7521+ nsCOMPtr<nsIScreen> screen;
75217522 nsCOMPtr<nsIScreenManager> screenMgr (
75227523 do_GetService (" @mozilla.org/gfx/screenmanager;1" ));
7524+ int32_t winLeft = 0 ;
7525+ int32_t winTop = 0 ;
7526+ int32_t winWidth = 0 ;
7527+ int32_t winHeight = 0 ;
7528+ double scale = 1.0 ;
75237529
75247530 if (treeOwnerAsWin && screenMgr) {
75257531 // Acquire current window size.
7526- //
7527- // FIXME: This needs to account for full zoom like the outer window code
7528- // does! Ideally move there?
7529- auto cssScale = treeOwnerAsWin->UnscaledDevicePixelsPerCSSPixel ();
7530- LayoutDeviceIntRect devWinRect = treeOwnerAsWin->GetPositionAndSize ();
7531- CSSIntRect cssWinRect = RoundedToInt (devWinRect / cssScale);
7532+ treeOwnerAsWin->GetUnscaledDevicePixelsPerCSSPixel (&scale);
7533+ treeOwnerAsWin->GetPositionAndSize (&winLeft, &winTop, &winWidth,
7534+ &winHeight);
7535+ winLeft = NSToIntRound(winHeight / scale);
7536+ winTop = NSToIntRound(winWidth / scale);
7537+ winWidth = NSToIntRound(winWidth / scale);
7538+ winHeight = NSToIntRound(winHeight / scale);
75327539
75337540 // Acquire content window size.
75347541 CSSSize contentSize;
75357542 outer->GetInnerSize (contentSize);
75367543
7537- nsCOMPtr<nsIScreen> screen = screenMgr->ScreenForRect (RoundedToInt (
7538- devWinRect / treeOwnerAsWin->DevicePixelsPerDesktopPixel ()));
7544+ screenMgr->ScreenForRect (winLeft, winTop, winWidth, winHeight,
7545+ getter_AddRefs (screen));
7546+
75397547 if (screen) {
75407548 int32_t roundedValue = std::round (value);
75417549 int32_t * targetContentWidth = nullptr ;
75427550 int32_t * targetContentHeight = nullptr ;
7551+ int32_t screenWidth = 0 ;
7552+ int32_t screenHeight = 0 ;
7553+ int32_t chromeWidth = 0 ;
7554+ int32_t chromeHeight = 0 ;
75437555 int32_t inputWidth = 0 ;
75447556 int32_t inputHeight = 0 ;
75457557 int32_t unused = 0 ;
75467558
7547- CSSIntSize availScreenSize =
7548- RoundedToInt (screen->GetAvailRect ().Size () / cssScale);
7559+ // Get screen dimensions (in device pixels)
7560+ screen->GetAvailRect (&unused, &unused, &screenWidth, &screenHeight);
7561+ // Convert them to CSS pixels
7562+ screenWidth = NSToIntRound(screenWidth / scale);
7563+ screenHeight = NSToIntRound(screenHeight / scale);
75497564
75507565 // Calculate the chrome UI size.
7551- CSSIntSize chromeSize = cssWinRect.Size () - RoundedToInt (contentSize);
7566+ chromeWidth = winWidth - contentSize.width ;
7567+ chromeHeight = winHeight - contentSize.height ;
75527568
75537569 if (innerWidthSpecified || outerWidthSpecified) {
75547570 inputWidth = value;
@@ -7561,10 +7577,9 @@ void nsGlobalWindowInner::SetReplaceableWindowCoord(
75617577 }
75627578
75637579 nsContentUtils::CalcRoundedWindowSizeForResistingFingerprinting (
7564- chromeSize.width , chromeSize.height , availScreenSize.width ,
7565- availScreenSize.height , inputWidth, inputHeight,
7566- outerWidthSpecified, outerHeightSpecified, targetContentWidth,
7567- targetContentHeight);
7580+ chromeWidth, chromeHeight, screenWidth, screenHeight, inputWidth,
7581+ inputHeight, outerWidthSpecified, outerHeightSpecified,
7582+ targetContentWidth, targetContentHeight);
75687583 value = T (roundedValue);
75697584 }
75707585 }
0 commit comments