bug 819725 pt 1.1 - don't round device-pixel coordinates in nsView and nsXULWindow when calling widget APIs to move/resize windows. r=roc
authorJonathan Kew <jkew@mozilla.com>
Wed, 12 Dec 2012 09:57:48 +0000
changeset 121349 b224adb34456da4f9da56271254d37941cf30d0e
parent 121348 d5cd9651e99a1b3ab23e23ecc7ed47c64fe0a8e3
child 121350 5e6a558cbebe1f9ebcc76cc62bfef39fcc3ef80c
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs819725
milestone20.0a1
bug 819725 pt 1.1 - don't round device-pixel coordinates in nsView and nsXULWindow when calling widget APIs to move/resize windows. r=roc
view/src/nsView.cpp
xpfe/appshell/src/nsXULWindow.cpp
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -278,29 +278,29 @@ void nsView::DoResetWidgetBounds(bool aM
   // hidpi/lodpi screens to overlap each other and result in bad placement
   // (bug 814434).
   nsRefPtr<nsDeviceContext> dx;
   mViewManager->GetDeviceContext(*getter_AddRefs(dx));
   double invScale = dx->UnscaledAppUnitsPerDevPixel() / 60.0;
 
   if (changedPos) {
     if (changedSize && !aMoveOnly) {
-      mWindow->ResizeClient(NSToIntRound(newBounds.x * invScale),
-                            NSToIntRound(newBounds.y * invScale),
-                            NSToIntRound(newBounds.width * invScale),
-                            NSToIntRound(newBounds.height * invScale),
+      mWindow->ResizeClient(newBounds.x * invScale,
+                            newBounds.y * invScale,
+                            newBounds.width * invScale,
+                            newBounds.height * invScale,
                             aInvalidateChangedSize);
     } else {
-      mWindow->MoveClient(NSToIntRound(newBounds.x * invScale),
-                          NSToIntRound(newBounds.y * invScale));
+      mWindow->MoveClient(newBounds.x * invScale,
+                          newBounds.y * invScale);
     }
   } else {
     if (changedSize && !aMoveOnly) {
-      mWindow->ResizeClient(NSToIntRound(newBounds.width * invScale),
-                            NSToIntRound(newBounds.height * invScale),
+      mWindow->ResizeClient(newBounds.width * invScale,
+                            newBounds.height * invScale,
                             aInvalidateChangedSize);
     } // else do nothing!
   }
 }
 
 void nsView::SetDimensions(const nsRect& aRect, bool aPaint, bool aResizeWidget)
 {
   nsRect dims = aRect;
--- a/xpfe/appshell/src/nsXULWindow.cpp
+++ b/xpfe/appshell/src/nsXULWindow.cpp
@@ -530,18 +530,17 @@ NS_IMETHODIMP nsXULWindow::GetUnscaledDe
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULWindow::SetPosition(int32_t aX, int32_t aY)
 {
   // Don't reset the window's size mode here - platforms that don't want to move
   // maximized windows should reset it in their respective Move implementation.
   double invScale = 1.0 / mWindow->GetDefaultScale();
-  nsresult rv = mWindow->Move(NSToIntRound(aX * invScale),
-                              NSToIntRound(aY * invScale));
+  nsresult rv = mWindow->Move(aX * invScale, aY * invScale);
   NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
   if (!mChromeLoaded) {
     // If we're called before the chrome is loaded someone obviously wants this
     // window at this position. We don't persist this one-time position.
     mIgnoreXULPosition = true;
     return NS_OK;
   }
   PersistentAttributesDirty(PAD_POSITION);
@@ -559,19 +558,17 @@ NS_IMETHODIMP nsXULWindow::SetSize(int32
   /* any attempt to set the window's size or position overrides the window's
      zoom state. this is important when these two states are competing while
      the window is being opened. but it should probably just always be so. */
   mWindow->SetSizeMode(nsSizeMode_Normal);
 
   mIntrinsicallySized = false;
 
   double invScale = 1.0 / mWindow->GetDefaultScale();
-  nsresult rv = mWindow->Resize(NSToIntRound(aCX * invScale),
-                                NSToIntRound(aCY * invScale),
-                                aRepaint);
+  nsresult rv = mWindow->Resize(aCX * invScale, aCY * invScale, aRepaint);
   NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
   if (!mChromeLoaded) {
     // If we're called before the chrome is loaded someone obviously wants this
     // window at this size & in the normal size mode (since it is the only mode
     // in which setting dimensions makes sense). We don't persist this one-time
     // size.
     mIgnoreXULSize = true;
     mIgnoreXULSizeMode = true;
@@ -593,20 +590,18 @@ NS_IMETHODIMP nsXULWindow::SetPositionAn
   /* any attempt to set the window's size or position overrides the window's
      zoom state. this is important when these two states are competing while
      the window is being opened. but it should probably just always be so. */
   mWindow->SetSizeMode(nsSizeMode_Normal);
 
   mIntrinsicallySized = false;
 
   double invScale = 1.0 / mWindow->GetDefaultScale();
-  nsresult rv = mWindow->Resize(NSToIntRound(aX * invScale),
-                                NSToIntRound(aY * invScale),
-                                NSToIntRound(aCX * invScale),
-                                NSToIntRound(aCY * invScale),
+  nsresult rv = mWindow->Resize(aX * invScale, aY * invScale,
+                                aCX * invScale, aCY * invScale,
                                 aRepaint);
   NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
   if (!mChromeLoaded) {
     // If we're called before the chrome is loaded someone obviously wants this
     // window at this size and position. We don't persist this one-time setting.
     mIgnoreXULPosition = true;
     mIgnoreXULSize = true;
     mIgnoreXULSizeMode = true;