Bug 1786048 - Part 2: Use layout device pixels for AppWindow primary content size. r=emilio

The getter used to return CSS pixels, while the setter expected layout
device pixels. The nsIDocShellTreeOwner documentation used to suggest that
CSS pixels are used for getters and setters of the primary content and
the root shell size. Only the getter for the primary content size
happend to match that documentation.

Differential Revision: https://phabricator.services.mozilla.com/D161944
This commit is contained in:
Matthias Camenzind
2022-11-30 19:37:16 +00:00
parent bba6a42299
commit e5c4c5d82a
3 changed files with 46 additions and 50 deletions

View File

@@ -2260,16 +2260,19 @@ static void SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner,
left = (LayoutDeviceCoord(devPxRect.x) / devToDesktopScale).Rounded();
top = (LayoutDeviceCoord(devPxRect.y) / devToDesktopScale).Rounded();
int32_t contentWidth, contentHeight; // CSS pixels.
LayoutDeviceIntSize contentSize;
bool hasPrimaryContent = false;
aTreeOwner->GetHasPrimaryContent(&hasPrimaryContent);
if (hasPrimaryContent) {
aTreeOwner->GetPrimaryContentSize(&contentWidth, &contentHeight);
aTreeOwner->GetPrimaryContentSize(&contentSize.width,
&contentSize.height);
} else {
aTreeOwner->GetRootShellSize(&contentWidth, &contentHeight);
aTreeOwner->GetRootShellSize(&contentSize.width, &contentSize.height);
}
chromeWidth = width - contentWidth;
chromeHeight = height - contentHeight;
CSSIntSize contentSizeCSS = RoundedToInt(contentSize / cssToDevScale);
chromeWidth = width - contentSizeCSS.width;
chromeHeight = height - contentSizeCSS.height;
}
// Set up left/top