From ac2ca00f06858c99e502ee6f74bff8906db91550 Mon Sep 17 00:00:00 2001 From: Matthew O'Connor Date: Wed, 9 Mar 2016 00:10:00 +0100 Subject: [PATCH] Bug 580165 - Clean up dead code related to missing screen managers in widget. r=jimm --HG-- extra : rebase_source : e472caf15d50a835ce06ad761f72d130371d442a --- widget/windows/nsWindow.cpp | 51 +++++++++++++++---------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 4faa34b2043b..39d441cdddd9 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -1834,42 +1834,31 @@ NS_METHOD nsWindow::ConstrainPosition(bool aAllowSlop, RECT screenRect; nsCOMPtr screenmgr = do_GetService(sScreenManagerContractID); - if (screenmgr) { - nsCOMPtr screen; - int32_t left, top, width, height; + if (!screenmgr) { + return NS_ERROR_NOT_AVAILABLE; + } + nsCOMPtr screen; + int32_t left, top, width, height; - screenmgr->ScreenForRect(*aX, *aY, logWidth, logHeight, - getter_AddRefs(screen)); - if (screen) { - if (mSizeMode != nsSizeMode_Fullscreen) { - // For normalized windows, use the desktop work area. - screen->GetAvailRectDisplayPix(&left, &top, &width, &height); - } else { - // For full screen windows, use the desktop. - screen->GetRectDisplayPix(&left, &top, &width, &height); - } - screenRect.left = left; - screenRect.right = left + width; - screenRect.top = top; - screenRect.bottom = top + height; + screenmgr->ScreenForRect(*aX, *aY, logWidth, logHeight, + getter_AddRefs(screen)); + if (mSizeMode != nsSizeMode_Fullscreen) { + // For normalized windows, use the desktop work area. + nsresult rv = screen->GetAvailRectDisplayPix(&left, &top, &width, &height); + if (NS_FAILED(rv)) { + return rv; } } else { - if (mWnd) { - HDC dc = ::GetDC(mWnd); - if (dc) { - if (::GetDeviceCaps(dc, TECHNOLOGY) == DT_RASDISPLAY) { - if (mSizeMode != nsSizeMode_Fullscreen) { - ::SystemParametersInfo(SPI_GETWORKAREA, 0, &screenRect, 0); - } else { - screenRect.left = screenRect.top = 0; - screenRect.right = GetSystemMetrics(SM_CXFULLSCREEN); - screenRect.bottom = GetSystemMetrics(SM_CYFULLSCREEN); - } - } - ::ReleaseDC(mWnd, dc); - } + // For full screen windows, use the desktop. + nsresult rv = screen->GetRectDisplayPix(&left, &top, &width, &height); + if (NS_FAILED(rv)) { + return rv; } } + screenRect.left = left; + screenRect.right = left + width; + screenRect.top = top; + screenRect.bottom = top + height; if (aAllowSlop) { if (*aX < screenRect.left - logWidth + kWindowPositionSlop)