From 14b3f5390b552437602c7407d9f566d06b0d16e0 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 20 Apr 2013 13:19:26 -0500 Subject: [PATCH] Bug 863889. nsWindow::Move should compare the same type of pixels when determining if we are moving the window at all. r=jfkthame --- widget/windows/nsWindow.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index ff4f652ffdd..33fe76391fd 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -1299,6 +1299,13 @@ NS_METHOD nsWindow::Move(double aX, double aY) mWindowType == eWindowType_dialog) { SetSizeMode(nsSizeMode_Normal); } + + // for top-level windows only, convert coordinates from global display pixels + // (the "parent" coordinate space) to the window's device pixel space + double scale = BoundsUseDisplayPixels() ? GetDefaultScale() : 1.0; + int32_t x = NSToIntRound(aX * scale); + int32_t y = NSToIntRound(aY * scale); + // Check to see if window needs to be moved first // to avoid a costly call to SetWindowPos. This check // can not be moved to the calling code in nsView, because @@ -1307,18 +1314,12 @@ NS_METHOD nsWindow::Move(double aX, double aY) // Only perform this check for non-popup windows, since the positioning can // in fact change even when the x/y do not. We always need to perform the // check. See bug #97805 for details. - if (mWindowType != eWindowType_popup && (mBounds.x == aX) && (mBounds.y == aY)) + if (mWindowType != eWindowType_popup && (mBounds.x == x) && (mBounds.y == y)) { // Nothing to do, since it is already positioned correctly. return NS_OK; } - // for top-level windows only, convert coordinates from global display pixels - // (the "parent" coordinate space) to the window's device pixel space - double scale = BoundsUseDisplayPixels() ? GetDefaultScale() : 1.0; - int32_t x = NSToIntRound(aX * scale); - int32_t y = NSToIntRound(aY * scale); - mBounds.x = x; mBounds.y = y;