Skip to content
Permalink
Browse files
fixup! Bug 19459: Size new windows to 1000x1000 or nearest 200x100
  • Loading branch information
arthuredelstein committed Nov 5, 2016
1 parent a30069f commit 0935e87b953cce40ac498ad49422c83f4cff30fb
Showing with 24 additions and 26 deletions.
  1. +24 −26 xpfe/appshell/nsXULWindow.cpp
@@ -1028,46 +1028,44 @@ NS_IMETHODIMP nsXULWindow::ResizeToRoundedDimensions()
int32_t availHeight = NSToIntRound(devicePerCSSPixels *
availHeightCSS); // device pixels
shellWindow->GetSize(&contentWidth, &contentHeight); // device pixels
// Useful for debugging:
//printf("\nscaling factor: %f\n", devicePerCSSPixels);
//printf("window size: %d x %d\n", windowWidth, windowHeight);
//printf("avail screen size: %d x %d\n", availWidth, availHeight);
//printf("primary content shell: %d x %d\n", contentWidth, contentHeight);
/* Useful for debugging:
printf("\nscaling factor: %f\n", devicePerCSSPixels);
printf("window size: %d x %d\n", windowWidth, windowHeight);
printf("avail screen size: %d x %d\n", availWidth, availHeight);
printf("primary content shell: %d x %d\n", contentWidth, contentHeight);
*/
int32_t chromeWidth = windowWidth - contentWidth;
int32_t chromeHeight = windowHeight - contentHeight;
int maxInnerWidth = Preferences::GetInt("privacy.window.maxInnerWidth",
INT_MAX);
1000);
int maxInnerHeight = Preferences::GetInt("privacy.window.maxInnerHeight",
INT_MAX);
1000);
int32_t availForContentWidthCSS =
std::min(maxInnerWidth,
NSToIntRound((0.95 * availWidth - chromeWidth) /
devicePerCSSPixels));
std::min(maxInnerWidth, NSToIntRound((0.95 * availWidth - chromeWidth) /
devicePerCSSPixels));
int32_t availForContentHeightCSS =
std::min(maxInnerHeight,
NSToIntRound((0.95 * availHeight - chromeHeight) /
devicePerCSSPixels));
std::min(maxInnerHeight, NSToIntRound((0.95 * availHeight - chromeHeight) /
devicePerCSSPixels));
int32_t targetContentWidth =
NSToIntRound(devicePerCSSPixels *
std::min(1000, availForContentWidthCSS -
(availForContentWidthCSS % 200)));
(availForContentWidthCSS - (availForContentWidthCSS % 200)));
int32_t targetContentHeight =
NSToIntRound(devicePerCSSPixels *
std::min(1000, availForContentHeightCSS -
(availForContentHeightCSS % 100)));
(availForContentHeightCSS - (availForContentHeightCSS % 100)));
SizeShellTo(mPrimaryContentShell,
targetContentWidth, targetContentHeight);
mIgnoreXULSize = true;
mIgnoreXULSizeMode = true;
// Useful for debugging:
//printf("target content size: %d, %d\n",
// targetContentWidth, targetContentHeight);
//GetSize(&windowWidth, &windowHeight);
//GetAvailScreenSize(&availWidth, &availHeight);
//shellWindow->GetSize(&contentWidth, &contentHeight); // device pixels
//printf("\nwindow size: %d x %d\n", windowWidth, windowHeight);
//printf("avail screen size: %d x %d\n", availWidth, availHeight);
//printf("primary content shell: %d x %d\n", contentWidth, contentHeight);
/* Useful for debugging:
printf("target content size: %d, %d\n",
targetContentWidth, targetContentHeight);
GetSize(&windowWidth, &windowHeight);
GetAvailScreenSize(&availWidth, &availHeight);
shellWindow->GetSize(&contentWidth, &contentHeight); // device pixels
printf("\nwindow size: %d x %d\n", windowWidth, windowHeight);
printf("avail screen size: %d x %d\n", availWidth, availHeight);
printf("primary content shell: %d x %d\n", contentWidth, contentHeight);
*/
return NS_OK;
}

0 comments on commit 0935e87

Please sign in to comment.