Bug 1240533 - Parameters to ScreenForRect need to be passed as desktop pixels, not device pixels. r=emk

This commit is contained in:
Jonathan Kew 2016-02-19 21:20:57 +00:00
parent 046dd4c97e
commit 7df35d9cfa

View File

@ -1553,9 +1553,12 @@ nsMenuPopupFrame::GetConstraintRect(const LayoutDeviceIntRect& aAnchorRect,
// 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.
LayoutDeviceIntRect rect = mInContentShell ? aRootScreenRect : aAnchorRect;
int32_t width = std::max(1, rect.width);
int32_t height = std::max(1, rect.height);
DesktopToLayoutDeviceScale scale =
PresContext()->DeviceContext()->GetDesktopToDeviceScale();
DesktopRect rect =
(mInContentShell ? aRootScreenRect : aAnchorRect) / scale;
int32_t width = std::max(1, NSToIntRound(rect.width));
int32_t height = std::max(1, NSToIntRound(rect.height));
sm->ScreenForRect(rect.x, rect.y, width, height, getter_AddRefs(screen));
if (screen) {
// Non-top-level popups (which will always be panels)