forked from mirrors/gecko-dev
Bug 1810614 - Simplify AppWindow::SizeShellTo when sizing to the window shell. r=smaug
In this case we can do easier things than going through the shell and assuming all sizes go through the window. Depends on D167027 Differential Revision: https://phabricator.services.mozilla.com/D166367
This commit is contained in:
parent
c60c74dac6
commit
f057dfb6db
1 changed files with 9 additions and 7 deletions
|
|
@ -2211,11 +2211,18 @@ nsresult AppWindow::SetRootShellSize(int32_t aWidth, int32_t aHeight) {
|
|||
|
||||
NS_IMETHODIMP AppWindow::SizeShellTo(nsIDocShellTreeItem* aShellItem,
|
||||
int32_t aCX, int32_t aCY) {
|
||||
MOZ_ASSERT(aShellItem == mDocShell || aShellItem == mPrimaryContentShell);
|
||||
if (aShellItem == mDocShell) {
|
||||
auto newSize =
|
||||
LayoutDeviceIntSize(aCX, aCY) + GetOuterToInnerSizeDifference(mWindow);
|
||||
SetSize(newSize.width, newSize.height, /* aRepaint = */ true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXXTAB This is wrong, we should actually reflow based on the passed in
|
||||
// shell. For now we are hacking and doing delta sizing. This is bad
|
||||
// because it assumes all size we add will go to the shell which probably
|
||||
// won't happen.
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(aShellItem));
|
||||
NS_ENSURE_TRUE(shellAsWin, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
@ -2604,11 +2611,6 @@ void AppWindow::IntrinsicallySizeShell(const CSSIntSize& aWindowDiff,
|
|||
return;
|
||||
}
|
||||
RefPtr<nsDocShell> docShell = mDocShell;
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
docShell->GetTreeOwner(getter_AddRefs(treeOwner));
|
||||
if (!treeOwner) {
|
||||
return;
|
||||
}
|
||||
|
||||
CSSIntCoord maxWidth = 0;
|
||||
CSSIntCoord maxHeight = 0;
|
||||
|
|
@ -2637,7 +2639,7 @@ void AppWindow::IntrinsicallySizeShell(const CSSIntSize& aWindowDiff,
|
|||
|
||||
int32_t width = pc->CSSPixelsToDevPixels(size->width);
|
||||
int32_t height = pc->CSSPixelsToDevPixels(size->height);
|
||||
treeOwner->SizeShellTo(docShell, width, height);
|
||||
SizeShellTo(docShell, width, height);
|
||||
|
||||
// Update specified size for the final LoadPositionFromXUL call.
|
||||
aSpecWidth = size->width + aWindowDiff.width;
|
||||
|
|
|
|||
Loading…
Reference in a new issue