Bug 1224482 (part 1) - Tweak typed/untyped versions of Get{,Client,Screen}Bounds(). r=kats.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 12 Nov 2015 16:04:52 -0800
changeset 306866 c289aa0d6c842f66a6bc716c6f4322df0dcad085
parent 306865 951e77fb1760a8f2047fe7f83217f69f480181a2
child 306867 d77e6ba0c79530b5ffb2211140fbf7cbb3d0614a
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1224482
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1224482 (part 1) - Tweak typed/untyped versions of Get{,Client,Screen}Bounds(). r=kats. In nsIWidget, GetBoundsUntyped(), GetClientBoundsUntyped() and GetScreenBoundsUntyped() are currently the primary implementations, and the untyped versions are defined on top of them. This patch flips that around.
gfx/tests/gtest/TestCompositor.cpp
widget/PuppetWidget.cpp
widget/PuppetWidget.h
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
widget/nsIWidget.h
widget/qt/nsWindow.cpp
widget/qt/nsWindow.h
widget/uikit/nsWindow.h
widget/uikit/nsWindow.mm
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
--- a/gfx/tests/gtest/TestCompositor.cpp
+++ b/gfx/tests/gtest/TestCompositor.cpp
@@ -29,22 +29,22 @@ using namespace mozilla::gl;
 
 class MockWidget : public nsBaseWidget
 {
 public:
   MockWidget() {}
 
   NS_DECL_ISUPPORTS_INHERITED
 
-  NS_IMETHOD GetClientBoundsUntyped(IntRect &aRect) override {
-    aRect = IntRect(0, 0, gCompWidth, gCompHeight);
+  NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override {
+    aRect = LayoutDeviceIntRect(0, 0, gCompWidth, gCompHeight);
     return NS_OK;
   }
-  NS_IMETHOD GetBoundsUntyped(IntRect &aRect) override {
-    return GetClientBoundsUntyped(aRect);
+  NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override {
+    return GetClientBounds(aRect);
   }
 
   void* GetNativeData(uint32_t aDataType) override {
     if (aDataType == NS_NATIVE_OPENGL_CONTEXT) {
       mozilla::gl::SurfaceCaps caps = mozilla::gl::SurfaceCaps::ForRGB();
       caps.preserve = false;
       caps.bpp16 = false;
       RefPtr<GLContext> context = GLContextProvider::CreateOffscreen(
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -1166,19 +1166,19 @@ PuppetWidget::GetWindowPosition()
   }
 
   int32_t winX, winY, winW, winH;
   NS_ENSURE_SUCCESS(GetOwningTabChild()->GetDimensions(0, &winX, &winY, &winW, &winH), nsIntPoint());
   return nsIntPoint(winX, winY);
 }
 
 NS_METHOD
-PuppetWidget::GetScreenBoundsUntyped(nsIntRect &aRect) {
-  aRect.MoveTo(WidgetToScreenOffset().ToUnknownPoint());
-  aRect.SizeTo(mBounds.Size());
+PuppetWidget::GetScreenBounds(LayoutDeviceIntRect& aRect) {
+  aRect.MoveTo(WidgetToScreenOffset());
+  aRect.SizeTo(LayoutDeviceIntSize::FromUnknownSize(mBounds.Size()));
   return NS_OK;
 }
 
 uint32_t PuppetWidget::GetMaxTouchPoints() const
 {
   static uint32_t sTouchPoints = 0;
   static bool sIsInitialized = false;
   if (sIsInitialized) {
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -207,17 +207,17 @@ public:
   nsIntSize GetScreenDimensions();
 
   // Get the size of the chrome of the window that this tab belongs to.
   nsIntPoint GetChromeDimensions();
 
   // Get the screen position of the application window.
   nsIntPoint GetWindowPosition();
 
-  NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) override;
+  NS_IMETHOD GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
 
   NS_IMETHOD StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
                             int32_t aPanelX, int32_t aPanelY,
                             nsString& aCommitted) override;
 
   NS_IMETHOD SetPluginFocused(bool& aFocused) override;
 
   virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -948,17 +948,17 @@ nsWindow::BringToFront()
     }
 
     // force a window resize
     nsAppShell::gAppShell->ResendLastResizeEvent(newTop);
     RedrawAll();
 }
 
 NS_IMETHODIMP
-nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
+nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
 {
     LayoutDeviceIntPoint p = WidgetToScreenOffset();
 
     aRect.x = p.x;
     aRect.y = p.y;
     aRect.width = mBounds.width;
     aRect.height = mBounds.height;
 
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -100,17 +100,17 @@ public:
     NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
                            nsIWidget *aWidget,
                            bool aActivate) override;
     NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
     NS_IMETHOD Enable(bool aState) override;
     virtual bool IsEnabled() const override;
     NS_IMETHOD Invalidate(const nsIntRect &aRect) override;
     NS_IMETHOD SetFocus(bool aRaise = false) override;
-    NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) override;
+    NS_IMETHOD GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
     virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override;
     NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                              nsEventStatus& aStatus) override;
     nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent);
     NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr) override;
     NS_IMETHOD SetWindowClass(const nsAString& xulWinType) override;
 
 
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -373,19 +373,19 @@ public:
   NS_IMETHOD              Move(double aX, double aY) override;
   NS_IMETHOD              Resize(double aWidth, double aHeight, bool aRepaint) override;
   NS_IMETHOD              Resize(double aX, double aY,
                                  double aWidth, double aHeight, bool aRepaint) override;
 
   NS_IMETHOD              Enable(bool aState) override;
   virtual bool            IsEnabled() const override;
   NS_IMETHOD              SetFocus(bool aRaise) override;
-  NS_IMETHOD              GetBoundsUntyped(nsIntRect &aRect) override;
-  NS_IMETHOD              GetClientBoundsUntyped(nsIntRect &aRect) override;
-  NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &aRect) override;
+  NS_IMETHOD              GetBounds(mozilla::LayoutDeviceIntRect &aRect) override;
+  NS_IMETHOD              GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) override;
+  NS_IMETHOD              GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
 
   // Returns the "backing scale factor" of the view's window, which is the
   // ratio of pixels in the window's backing store to Cocoa points. Prior to
   // HiDPI support in OS X 10.7, this was always 1.0, but in HiDPI mode it
   // will be 2.0 (and might potentially other values as screen resolutions
   // evolve). This gives the relationship between what Gecko calls "device
   // pixels" and the Cocoa "points" coordinate system.
   CGFloat                 BackingScaleFactor() const;
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -901,41 +901,43 @@ NS_IMETHODIMP nsChildView::SetCursor(img
   return [[nsCursorManager sharedInstance] setCursorWithImage:aCursor hotSpotX:aHotspotX hotSpotY:aHotspotY scaleFactor:BackingScaleFactor()];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 #pragma mark -
 
 // Get this component dimension
-NS_IMETHODIMP nsChildView::GetBoundsUntyped(nsIntRect &aRect)
-{
+NS_IMETHODIMP nsChildView::GetBounds(LayoutDeviceIntRect& aRect)
+{
+  nsIntRect tmp;
   if (!mView) {
-    aRect = mBounds;
+    tmp = mBounds;
   } else {
-    aRect = CocoaPointsToDevPixels([mView frame]);
-  }
+    tmp = CocoaPointsToDevPixels([mView frame]);
+  }
+  aRect = LayoutDeviceIntRect::FromUnknownRect(tmp);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsChildView::GetClientBoundsUntyped(nsIntRect &aRect)
-{
-  GetBoundsUntyped(aRect);
+NS_IMETHODIMP nsChildView::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect)
+{
+  GetBounds(aRect);
   if (!mParentWidget) {
     // For top level widgets we want the position on screen, not the position
     // of this view inside the window.
-    aRect.MoveTo(WidgetToScreenOffset().ToUnknownPoint());
+    aRect.MoveTo(WidgetToScreenOffset());
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP nsChildView::GetScreenBoundsUntyped(nsIntRect &aRect)
-{
-  GetBoundsUntyped(aRect);
-  aRect.MoveTo(WidgetToScreenOffset().ToUnknownPoint());
+NS_IMETHODIMP nsChildView::GetScreenBounds(LayoutDeviceIntRect& aRect)
+{
+  GetBounds(aRect);
+  aRect.MoveTo(WidgetToScreenOffset());
   return NS_OK;
 }
 
 double
 nsChildView::GetDefaultScaleInternal()
 {
   return BackingScaleFactor();
 }
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -302,18 +302,18 @@ public:
       MOZ_ASSERT(mFullscreenTransitionAnimation,
                  "Should only be called when there is animation");
       [mFullscreenTransitionAnimation release];
       mFullscreenTransitionAnimation = nil;
     }
 
     NS_IMETHOD              Resize(double aWidth, double aHeight, bool aRepaint) override;
     NS_IMETHOD              Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
-    NS_IMETHOD              GetClientBoundsUntyped(nsIntRect &aRect) override;
-    NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &aRect) override;
+    NS_IMETHOD              GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) override;
+    NS_IMETHOD              GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
     void                    ReportMoveEvent();
     void                    ReportSizeEvent();
     NS_IMETHOD              SetCursor(nsCursor aCursor) override;
     NS_IMETHOD              SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY) override;
 
     CGFloat                 BackingScaleFactor();
     void                    BackingScaleFactorChanged();
     virtual double          GetDefaultScaleInternal() override;
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -1545,61 +1545,63 @@ NS_IMETHODIMP nsCocoaWindow::Resize(doub
 // Coordinates are global display pixels
 NS_IMETHODIMP nsCocoaWindow::Resize(double aWidth, double aHeight, bool aRepaint)
 {
   double invScale = 1.0 / GetDefaultScale().scale;
   return DoResize(mBounds.x * invScale, mBounds.y * invScale,
                   aWidth, aHeight, aRepaint, true);
 }
 
-NS_IMETHODIMP nsCocoaWindow::GetClientBoundsUntyped(nsIntRect &aRect)
+NS_IMETHODIMP nsCocoaWindow::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   CGFloat scaleFactor = BackingScaleFactor();
   if (!mWindow) {
-    aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor);
+    aRect = LayoutDeviceIntRect::FromUnknownRect(
+      nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor));
     return NS_OK;
   }
 
   NSRect r;
   if ([mWindow isKindOfClass:[ToolbarWindow class]] &&
       [(ToolbarWindow*)mWindow drawsContentsIntoWindowFrame]) {
     r = [mWindow frame];
   } else {
     r = [mWindow contentRectForFrameRect:[mWindow frame]];
   }
 
-  aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor);
+  aRect = LayoutDeviceIntRect::FromUnknownRect(
+    nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor));
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 void
 nsCocoaWindow::UpdateBounds()
 {
   NSRect frame = NSZeroRect;
   if (mWindow) {
     frame = [mWindow frame];
   }
   mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
 }
 
-NS_IMETHODIMP nsCocoaWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
+NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
 #ifdef DEBUG
   nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
   NS_ASSERTION(mWindow && mBounds == r, "mBounds out of sync!");
 #endif
 
-  aRect = mBounds;
+  aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 double
 nsCocoaWindow::GetDefaultScaleInternal()
 {
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1476,50 +1476,50 @@ nsWindow::SetFocus(bool aRaise)
 
     LOGFOCUS(("  widget now has focus in SetFocus() [%p]\n",
               (void *)this));
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
+nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
 {
     if (mIsTopLevel && mContainer) {
         // use the point including window decorations
         gint x, y;
         gdk_window_get_root_origin(gtk_widget_get_window(GTK_WIDGET(mContainer)), &x, &y);
-        aRect.MoveTo(GdkPointToDevicePixels({ x, y }).ToUnknownPoint());
+        aRect.MoveTo(GdkPointToDevicePixels({ x, y }));
     } else {
-        aRect.MoveTo(WidgetToScreenOffset().ToUnknownPoint());
+        aRect.MoveTo(WidgetToScreenOffset());
     }
     // mBounds.Size() is the window bounds, not the window-manager frame
     // bounds (bug 581863).  gdk_window_get_frame_extents would give the
     // frame bounds, but mBounds.Size() is returned here for consistency
     // with Resize.
-    aRect.SizeTo(mBounds.Size());
-    LOG(("GetScreenBoundsUntyped %d,%d | %dx%d\n",
+    aRect.SizeTo(LayoutDeviceIntSize::FromUnknownSize(mBounds.Size()));
+    LOG(("GetScreenBounds %d,%d | %dx%d\n",
          aRect.x, aRect.y, aRect.width, aRect.height));
     return NS_OK;
 }
 
 gfx::IntSize
 nsWindow::GetClientSize()
 {
   return gfx::IntSize(mBounds.width, mBounds.height);
 }
 
 NS_IMETHODIMP
-nsWindow::GetClientBoundsUntyped(nsIntRect &aRect)
+nsWindow::GetClientBounds(LayoutDeviceIntRect& aRect)
 {
     // GetBounds returns a rect whose top left represents the top left of the
     // outer bounds, but whose width/height represent the size of the inner
     // bounds (which is messed up).
-    GetBoundsUntyped(aRect);
-    aRect.MoveBy(GetClientOffsetUntyped());
+    GetBounds(aRect);
+    aRect.MoveBy(GetClientOffset());
 
     return NS_OK;
 }
 
 void
 nsWindow::UpdateClientOffset()
 {
     PROFILER_LABEL("nsWindow", "UpdateClientOffset", js::ProfileEntry::Category::GRAPHICS);
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -126,18 +126,18 @@ public:
 
     NS_IMETHOD         PlaceBehind(nsTopLevelWidgetZPlacement  aPlacement,
                                    nsIWidget                  *aWidget,
                                    bool                        aActivate) override;
     void               SetZIndex(int32_t aZIndex) override;
     NS_IMETHOD         SetSizeMode(nsSizeMode aMode) override;
     NS_IMETHOD         Enable(bool aState) override;
     NS_IMETHOD         SetFocus(bool aRaise = false) override;
-    NS_IMETHOD         GetScreenBoundsUntyped(nsIntRect &aRect) override;
-    NS_IMETHOD         GetClientBoundsUntyped(nsIntRect &aRect) override;
+    NS_IMETHOD         GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
+    NS_IMETHOD         GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) override;
     virtual mozilla::gfx::IntSize GetClientSize() override;
     virtual nsIntPoint GetClientOffsetUntyped() override;
     NS_IMETHOD         SetCursor(nsCursor aCursor) override;
     NS_IMETHOD         SetCursor(imgIContainer* aCursor,
                                  uint32_t aHotspotX, uint32_t aHotspotY) override;
     NS_IMETHOD         Invalidate(const nsIntRect &aRect) override;
     virtual void*      GetNativeData(uint32_t aDataType) override;
     void               SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1305,42 +1305,42 @@ NS_METHOD nsBaseWidget::ResizeClient(dou
 // Bounds
 //
 //-------------------------------------------------------------------------
 
 /**
 * If the implementation of nsWindow supports borders this method MUST be overridden
 *
 **/
-NS_METHOD nsBaseWidget::GetClientBoundsUntyped(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetClientBounds(LayoutDeviceIntRect &aRect)
 {
-  return GetBoundsUntyped(aRect);
+  return GetBounds(aRect);
 }
 
 /**
 * If the implementation of nsWindow supports borders this method MUST be overridden
 *
 **/
-NS_METHOD nsBaseWidget::GetBoundsUntyped(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetBounds(LayoutDeviceIntRect &aRect)
 {
-  aRect = mBounds;
+  aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
   return NS_OK;
 }
 
 /**
 * If the implementation of nsWindow uses a local coordinate system within the window,
 * this method must be overridden
 *
 **/
-NS_METHOD nsBaseWidget::GetScreenBoundsUntyped(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetScreenBounds(LayoutDeviceIntRect& aRect)
 {
-  return GetBoundsUntyped(aRect);
+  return GetBounds(aRect);
 }
 
-NS_METHOD nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect &aRect)
+NS_METHOD nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect& aRect)
 {
   if (SizeMode() != nsSizeMode_Normal) {
     return NS_ERROR_FAILURE;
   }
   return GetScreenBounds(aRect);
 }
 
 nsIntPoint
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -182,19 +182,19 @@ public:
   // -setting- them (i.e. moving or resizing the widget) will always return
   // values in the widget's device pixels.
   bool                    BoundsUseDisplayPixels() const {
     return mWindowType <= eWindowType_popup;
   }
   NS_IMETHOD              MoveClient(double aX, double aY) override;
   NS_IMETHOD              ResizeClient(double aWidth, double aHeight, bool aRepaint) override;
   NS_IMETHOD              ResizeClient(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
-  NS_IMETHOD              GetBoundsUntyped(nsIntRect &aRect) override;
-  NS_IMETHOD              GetClientBoundsUntyped(nsIntRect &aRect) override;
-  NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &aRect) override;
+  NS_IMETHOD              GetBounds(mozilla::LayoutDeviceIntRect &aRect) override;
+  NS_IMETHOD              GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) override;
+  NS_IMETHOD              GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
   NS_IMETHOD              GetRestoredBounds(mozilla::LayoutDeviceIntRect &aRect) override;
   NS_IMETHOD              GetNonClientMargins(
                             mozilla::LayoutDeviceIntMargin &margins) override;
   NS_IMETHOD              SetNonClientMargins(
                             mozilla::LayoutDeviceIntMargin &margins) override;
   virtual nsIntPoint      GetClientOffsetUntyped() override;
   NS_IMETHOD              EnableDragDrop(bool aEnable) override;
   NS_IMETHOD              GetAttention(int32_t aCycleCount) override;
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -803,41 +803,41 @@ class nsIWidget : public nsISupports {
      * relative to its parent widget.
      *
      * The untyped version exists temporarily to ease conversion to typed
      * coordinates.
      *
      * @param aRect   On return it holds the  x, y, width and height of
      *                this widget.
      */
-    NS_IMETHOD GetBounds(mozilla::LayoutDeviceIntRect &aRect) {
-      nsIntRect tmp;
-      nsresult rv = GetBoundsUntyped(tmp);
-      aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
+    NS_IMETHOD GetBounds(mozilla::LayoutDeviceIntRect &aRect) = 0;
+    NS_IMETHOD GetBoundsUntyped(nsIntRect &aRect) {
+      mozilla::LayoutDeviceIntRect tmp;
+      nsresult rv = GetBounds(tmp);
+      aRect = tmp.ToUnknownRect();
       return rv;
     }
-    NS_IMETHOD GetBoundsUntyped(nsIntRect &aRect) = 0;
 
     /**
      * Get this widget's outside dimensions in global coordinates. This
      * includes any title bar on the window.
      *
      * The untyped version exists temporarily to ease conversion to typed
      * coordinates.
      *
      * @param aRect   On return it holds the  x, y, width and height of
      *                this widget.
      */
-    NS_IMETHOD GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) {
-      nsIntRect tmp;
-      nsresult rv = GetScreenBoundsUntyped(tmp);
-      aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
+    NS_IMETHOD GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) = 0;
+    NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) {
+      mozilla::LayoutDeviceIntRect tmp;
+      nsresult rv = GetScreenBounds(tmp);
+      aRect = tmp.ToUnknownRect();
       return rv;
     }
-    NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &aRect) = 0;
 
     /**
      * Similar to GetScreenBounds except that this function will always
      * get the size when the widget is in the nsSizeMode_Normal size mode
      * even if the current size mode is not nsSizeMode_Normal.
      * This method will fail if the size mode is not nsSizeMode_Normal and
      * the platform doesn't have the ability.
      * This method will always succeed if the current size mode is
@@ -855,23 +855,23 @@ class nsIWidget : public nsISupports {
      * widget (for root widgets and popup widgets it is in screen coordinates).
      *
      * The untyped version exists temporarily to ease conversion to typed
      * coordinates.
      *
      * @param aRect   On return it holds the  x. y, width and height of
      *                the client area of this widget.
      */
-    NS_IMETHOD GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) {
-      nsIntRect tmp;
-      nsresult rv = GetClientBoundsUntyped(tmp);
-      aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
+    NS_IMETHOD GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) = 0;
+    NS_IMETHOD GetClientBoundsUntyped(nsIntRect &aRect) {
+      mozilla::LayoutDeviceIntRect tmp;
+      nsresult rv = GetClientBounds(tmp);
+      aRect = tmp.ToUnknownRect();
       return rv;
     }
-    NS_IMETHOD GetClientBoundsUntyped(nsIntRect &aRect) = 0;
 
     /**
      * Get the non-client area dimensions of the window.
      */
     NS_IMETHOD GetNonClientMargins(mozilla::LayoutDeviceIntMargin &margins) = 0;
 
     /**
      * Sets the non-client area dimensions of the window. Pass -1 to restore
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -1495,24 +1495,25 @@ void find_first_visible_parent(QWindow* 
                 aItem->setVisible(true);
                 aVisibleItem = aItem;
             }
         }
     }
 }
 
 NS_IMETHODIMP
-nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
+nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
 {
-    aRect = gfx::IntRect(gfx::IntPoint(0, 0), mBounds.Size());
+    aRect = LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0),
+                                LayoutDeviceIntSize::FromUnknownSize(mBounds.Size()));
     if (mIsTopLevel) {
         QPoint pos = mWidget->position();
         aRect.MoveTo(pos.x(), pos.y());
     } else {
-        aRect.MoveTo(WidgetToScreenOffset().ToUnknownPoint());
+        aRect.MoveTo(WidgetToScreenOffset());
     }
     LOG(("GetScreenBounds %d %d | %d %d | %d %d\n",
          aRect.x, aRect.y,
          mBounds.width, mBounds.height,
          aRect.width, aRect.height));
     return NS_OK;
 }
 
--- a/widget/qt/nsWindow.h
+++ b/widget/qt/nsWindow.h
@@ -198,17 +198,17 @@ public:
     NS_IMETHOD         SetParent(nsIWidget* aNewParent);
     virtual nsIWidget *GetParent(void);
     virtual float      GetDPI();
     NS_IMETHOD         SetModal(bool aModal);
     NS_IMETHOD         PlaceBehind(nsTopLevelWidgetZPlacement  aPlacement,
                                    nsIWidget                  *aWidget,
                                    bool                        aActivate);
     NS_IMETHOD         SetSizeMode(nsSizeMode aMode);
-    NS_IMETHOD         GetScreenBoundsUntyped(nsIntRect &aRect);
+    NS_IMETHOD         GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
     NS_IMETHOD         SetHasTransparentBackground(bool aTransparent);
     NS_IMETHOD         GetHasTransparentBackground(bool& aTransparent);
     NS_IMETHOD         HideWindowChrome(bool aShouldHide);
     NS_IMETHOD         SetIcon(const nsAString& aIconSpec);
     NS_IMETHOD         CaptureMouse(bool aCapture);
     NS_IMETHOD         SetWindowClass(const nsAString& xulWinType);
     NS_IMETHOD         GetAttention(int32_t aCycleCount);
     NS_IMETHOD_(bool)  HasGLContext();
--- a/widget/uikit/nsWindow.h
+++ b/widget/uikit/nsWindow.h
@@ -56,17 +56,17 @@ public:
                                               int32_t *aX, int32_t *aY) override;
     NS_IMETHOD              Move(double aX, double aY) override;
     NS_IMETHOD              PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
                                         nsIWidget *aWidget, bool aActivate) override;
     NS_IMETHOD              SetSizeMode(nsSizeMode aMode) override;
     void                    EnteredFullScreen(bool aFullScreen);
     NS_IMETHOD              Resize(double aWidth, double aHeight, bool aRepaint) override;
     NS_IMETHOD              Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
-    NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &aRect) override;
+    NS_IMETHOD              GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
     void                    ReportMoveEvent();
     void                    ReportSizeEvent();
     void                    ReportSizeModeEvent(nsSizeMode aMode);
 
     CGFloat                 BackingScaleFactor();
     void                    BackingScaleFactorChanged();
     virtual float           GetDPI() override {
         //XXX: terrible
--- a/widget/uikit/nsWindow.mm
+++ b/widget/uikit/nsWindow.mm
@@ -774,17 +774,17 @@ void nsWindow::ReportSizeEvent()
     if (mWidgetListener) {
         LayoutDeviceIntRect innerBounds;
         GetClientBounds(innerBounds);
         mWidgetListener->WindowResized(this, innerBounds.width, innerBounds.height);
     }
 }
 
 NS_IMETHODIMP
-nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
+nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
 {
     LayoutDeviceIntPoint p = WidgetToScreenOffset();
 
     aRect.x = p.x;
     aRect.y = p.y;
     aRect.width = mBounds.width;
     aRect.height = mBounds.height;
 
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1859,17 +1859,17 @@ NS_METHOD nsWindow::SetFocus(bool aRaise
  *
  * Bound calculations.
  *
  **************************************************************/
 
 // Return the window's full dimensions in screen coordinates.
 // If the window has a parent, converts the origin to an offset
 // of the parent's screen origin.
-NS_METHOD nsWindow::GetBoundsUntyped(nsIntRect &aRect)
+NS_METHOD nsWindow::GetBounds(LayoutDeviceIntRect& aRect)
 {
   if (mWnd) {
     RECT r;
     VERIFY(::GetWindowRect(mWnd, &r));
 
     // assign size
     aRect.width  = r.right - r.left;
     aRect.height = r.bottom - r.top;
@@ -1921,54 +1921,54 @@ NS_METHOD nsWindow::GetBoundsUntyped(nsI
         LayoutDeviceIntPoint clientOffset = pWidget->GetClientOffset();
         r.left -= clientOffset.x;
         r.top  -= clientOffset.y;
       }
     }
     aRect.x = r.left;
     aRect.y = r.top;
   } else {
-    aRect = mBounds;
+    aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
   }
   return NS_OK;
 }
 
 // Get this component dimension
-NS_METHOD nsWindow::GetClientBoundsUntyped(nsIntRect &aRect)
+NS_METHOD nsWindow::GetClientBounds(LayoutDeviceIntRect& aRect)
 {
   if (mWnd) {
     RECT r;
     VERIFY(::GetClientRect(mWnd, &r));
 
-    nsIntRect bounds;
-    GetBoundsUntyped(bounds);
-    aRect.MoveTo(bounds.TopLeft() + GetClientOffsetUntyped());
+    LayoutDeviceIntRect bounds;
+    GetBounds(bounds);
+    aRect.MoveTo(bounds.TopLeft() + GetClientOffset());
     aRect.width  = r.right - r.left;
     aRect.height = r.bottom - r.top;
 
   } else {
     aRect.SetRect(0,0,0,0);
   }
   return NS_OK;
 }
 
 // Like GetBounds, but don't offset by the parent
-NS_METHOD nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
+NS_METHOD nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
 {
   if (mWnd) {
     RECT r;
     VERIFY(::GetWindowRect(mWnd, &r));
 
     aRect.width  = r.right - r.left;
     aRect.height = r.bottom - r.top;
     aRect.x = r.left;
     aRect.y = r.top;
-  } else
-    aRect = mBounds;
-
+  } else {
+    aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
+  }
   return NS_OK;
 }
 
 NS_METHOD nsWindow::GetRestoredBounds(LayoutDeviceIntRect &aRect)
 {
   if (SizeMode() == nsSizeMode_Normal) {
     return GetScreenBounds(aRect);
   }
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -111,20 +111,20 @@ public:
   NS_IMETHOD              BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
                                           int32_t aHorizontal,
                                           int32_t aVertical);
   NS_IMETHOD              PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
   NS_IMETHOD              SetSizeMode(nsSizeMode aMode);
   NS_IMETHOD              Enable(bool aState);
   virtual bool            IsEnabled() const;
   NS_IMETHOD              SetFocus(bool aRaise);
-  NS_IMETHOD              GetBoundsUntyped(nsIntRect &aRect);
-  NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &aRect);
+  NS_IMETHOD              GetBounds(mozilla::LayoutDeviceIntRect &aRect) override;
+  NS_IMETHOD              GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
   NS_IMETHOD              GetRestoredBounds(mozilla::LayoutDeviceIntRect &aRect) override;
-  NS_IMETHOD              GetClientBoundsUntyped(nsIntRect &aRect);
+  NS_IMETHOD              GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) override;
   virtual nsIntPoint      GetClientOffsetUntyped() override;
   void                    SetBackgroundColor(const nscolor &aColor);
   NS_IMETHOD              SetCursor(imgIContainer* aCursor,
                                     uint32_t aHotspotX, uint32_t aHotspotY);
   NS_IMETHOD              SetCursor(nsCursor aCursor);
   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
   virtual bool PrepareForFullscreenTransition(nsISupports** aData) override;
   virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage,