Backed out 2 changesets (bug 1614218) for causing Bug 1764624

Backed out changeset b46fde1669ca (bug 1614218)
Backed out changeset 0f6c40a96642 (bug 1614218)
This commit is contained in:
Norisz Fay 2022-04-13 22:37:52 +03:00
parent f1ae8a3f13
commit bb55e501b5
2 changed files with 28 additions and 9 deletions

View File

@ -1935,6 +1935,23 @@ bool nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
if (aAppearance == StyleAppearance::MozWindowTitlebar ||
aAppearance == StyleAppearance::MozWindowTitlebarMaximized) {
aResult->SizeTo(0, 0, 0, 0);
// XXX Maximized windows have an offscreen offset equal to
// the border padding. This should be addressed in nsWindow,
// but currently can't be, see UpdateNonClientMargins.
if (aAppearance == StyleAppearance::MozWindowTitlebarMaximized) {
nsCOMPtr<nsIWidget> rootWidget;
if (WinUtils::HasSystemMetricsForDpi()) {
rootWidget = aFrame->PresContext()->GetRootWidget();
}
if (rootWidget) {
double dpi = rootWidget->GetDPI();
aResult->top = WinUtils::GetSystemMetricsForDpi(SM_CXFRAME, dpi) +
WinUtils::GetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi);
} else {
aResult->top =
GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER);
}
}
return ok;
}

View File

@ -2889,13 +2889,15 @@ bool nsWindow::UpdateNonClientMargins(int32_t aSizeMode, bool aReflowWindow) {
mNonClientOffset.left = mHorResizeMargin;
mNonClientOffset.right = mHorResizeMargin;
} else if (aSizeMode == nsSizeMode_Maximized) {
// Move only the caption region offscreen. Does not affect the resize
// margins.
auto verticalResize =
WinUtils::GetSystemMetricsForDpi(SM_CYFRAME, dpi) +
(hasCaption ? WinUtils::GetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi)
: 0);
mNonClientOffset.top = mCaptionHeight - verticalResize;
// Remove the default frame from the top of our maximized window. This
// makes the whole caption part of our client area, allowing us to draw
// in the whole caption area. Use default frame size on left, right, and
// bottom. The reason this works is that, for maximized windows,
// Windows positions them so that their frames fall off the screen.
// This gives the illusion of windows having no frames when they are
// maximized. If we try to mess with the frame sizes by setting these
// offsets to positive values, our client area will fall off the screen.
mNonClientOffset.top = mCaptionHeight;
mNonClientOffset.bottom = 0;
mNonClientOffset.left = 0;
mNonClientOffset.right = 0;
@ -3055,8 +3057,8 @@ void nsWindow::InvalidateNonClientRegion() {
GetWindowRect(mWnd, &rect);
rect.top += mCaptionHeight;
rect.right -= mHorResizeMargin;
rect.bottom -= mVertResizeMargin;
rect.left += mHorResizeMargin;
rect.bottom -= mHorResizeMargin;
rect.left += mVertResizeMargin;
MapWindowPoints(nullptr, mWnd, (LPPOINT)&rect, 2);
HRGN clientRgn = CreateRectRgnIndirect(&rect);
CombineRgn(winRgn, winRgn, clientRgn, RGN_DIFF);