From b3475263bbe9e7427c7e21f4e1e6ca52608a5fca Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 6 Mar 2013 17:16:08 +0000 Subject: [PATCH] bug 799523 pt 1 - avoid mixing CSS-pix and device-pix coordinates in GetWindowInnerRectCenter. r=bz --- content/events/src/nsEventStateManager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index a243078b035e..d7712f9bb849 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -4173,7 +4173,13 @@ GetWindowInnerRectCenter(nsPIDOMWindow* aWindow, int32_t innerHeight = 0; aWindow->GetInnerHeight(&innerHeight); - + + // convert CSS pixels returned by GetInner{Width,Height} into device pixels + // (so we can legitimately combine them with innerX and innerY from above, + // and coords returned from aWidget->GetScreenBounds() below) + innerWidth = int32_t(NS_round(aContext->CSSPixelsToDevPixels(innerWidth))); + innerHeight = int32_t(NS_round(aContext->CSSPixelsToDevPixels(innerHeight))); + nsIntRect screen; aWidget->GetScreenBounds(screen);