From 7df35d9cfaf2c23ce18c01090826d8e311ee9ea4 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Fri, 19 Feb 2016 21:20:57 +0000 Subject: [PATCH] Bug 1240533 - Parameters to ScreenForRect need to be passed as desktop pixels, not device pixels. r=emk --- layout/xul/nsMenuPopupFrame.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index a6fdda78582..0f3722bcf14 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -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)