bug 794038 pt 1.2 - popup manager needs to use display pixels when constraining window to screen area. r=roc

This commit is contained in:
Jonathan Kew 2012-10-16 20:41:19 +01:00
parent ef80973c6f
commit c5e7186020

View File

@ -1318,10 +1318,11 @@ nsMenuPopupFrame::GetConstraintRect(const nsRect& aAnchorRect,
// so we should use the same screen. Otherwise, use the screen where the
// anchor is located.
nsRect rect = mInContentShell ? aRootScreenRect : aAnchorRect;
int32_t width = rect.width > 0 ? presContext->AppUnitsToDevPixels(rect.width) : 1;
int32_t height = rect.height > 0 ? presContext->AppUnitsToDevPixels(rect.height) : 1;
sm->ScreenForRect(presContext->AppUnitsToDevPixels(rect.x),
presContext->AppUnitsToDevPixels(rect.y),
// nsIScreenManager::ScreenForRect wants the coordinates in CSS pixels
int32_t width = NS_MAX(1, nsPresContext::AppUnitsToIntCSSPixels(rect.width));
int32_t height = NS_MAX(1, nsPresContext::AppUnitsToIntCSSPixels(rect.height));
sm->ScreenForRect(nsPresContext::AppUnitsToIntCSSPixels(rect.x),
nsPresContext::AppUnitsToIntCSSPixels(rect.y),
width, height, getter_AddRefs(screen));
if (screen) {
// get the total screen area if the popup is allowed to overlap it.