commit f768cdd414cd3900f6927550c1a6eccb42cad05a Author: Arthur Edelstein arthuredelstein@gmail.com Date: Thu Nov 3 13:41:34 2016 -0700
fixup! Bug 19459: Size new windows to 1000x1000 or nearest 200x100 --- xpfe/appshell/nsXULWindow.cpp | 50 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 26 deletions(-)
diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp index c523e31..b0b1f52 100644 --- a/xpfe/appshell/nsXULWindow.cpp +++ b/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; }
tbb-commits@lists.torproject.org