From 10e3ef1a717459a215c1e8c2418820578a13ec14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Mon, 7 Sep 2009 14:17:30 +0200 Subject: [PATCH] Backed out changeset 83ba2c6e25eb because of bug 514891 --- layout/xul/base/src/nsMenuPopupFrame.cpp | 32 ++++-------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index b05861fe077..f94496598d8 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -958,8 +958,6 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, PRBool aIsMove) // the screen rectangle of the root frame, in dev pixels. nsRect rootScreenRect = rootFrame->GetScreenRectInAppUnits(); - nsCOMPtr screenManager( - do_GetService("@mozilla.org/gfx/screenmanager;1")); nsIDeviceContext* devContext = presContext->DeviceContext(); nscoord offsetForContextMenu = 0; // if mScreenXPos and mScreenYPos are -1, then we are anchored. If they @@ -1014,27 +1012,6 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, PRBool aIsMove) nsPresContext::CSSPixelsToAppUnits(mScreenXPos) / factor); screenPoint.y = presContext->DevPixelsToAppUnits( nsPresContext::CSSPixelsToAppUnits(mScreenYPos) / factor); - - // The screen coordinates are relative to the screen that the window is on, - // so adjust them based on the topleft of the screen we are on so that they - // are in the absolute screen space. - if (screenManager) { - // get the screen that the root frame is on - nsCOMPtr screen; - screenManager->ScreenForRect( - presContext->AppUnitsToDevPixels(rootScreenRect.x), - presContext->AppUnitsToDevPixels(rootScreenRect.y), - presContext->AppUnitsToDevPixels(rootScreenRect.width), - presContext->AppUnitsToDevPixels(rootScreenRect.height), - getter_AddRefs(screen)); - nsIntRect screenRectPixels; - screen->GetRect(&screenRectPixels.x, &screenRectPixels.y, - &screenRectPixels.width, &screenRectPixels.height); - nsRect screenRect = - screenRectPixels.ToAppUnits(presContext->AppUnitsPerDevPixel()); - screenPoint += screenRect.TopLeft(); - } - anchorRect = nsRect(screenPoint, nsSize(0, 0)); // add the margins on the popup @@ -1056,15 +1033,16 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, PRBool aIsMove) // screen. nsIntRect screenRectPixels; nsCOMPtr screen; - if (screenManager) { + nsCOMPtr sm(do_GetService("@mozilla.org/gfx/screenmanager;1")); + if (sm) { // for context shells, get the screen where the root frame is located. // This is because we need to constrain the content to this content area, // so we should use the same screen. Otherwise, use the screen where the // anchor is located. nsPoint pnt = mInContentShell ? rootScreenRect.TopLeft() : anchorRect.TopLeft(); - screenManager->ScreenForRect(presContext->AppUnitsToDevPixels(pnt.x), - presContext->AppUnitsToDevPixels(pnt.y), - 1, 1, getter_AddRefs(screen)); + sm->ScreenForRect(presContext->AppUnitsToDevPixels(pnt.x), + presContext->AppUnitsToDevPixels(pnt.y), + 1, 1, getter_AddRefs(screen)); if (screen) { if (mMenuCanOverlapOSBar) screen->GetRect(&screenRectPixels.x, &screenRectPixels.y,