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
Родитель b6844877ae
Коммит 542f0307b7
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -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.