Bug 1223310 (part 2) - Use LayoutDeviceIntRect for bounds-related functions in nsIWidget. r=kats.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 09 Nov 2015 21:37:32 -0800
changeset 272066 49a5f1fe2128ff16b17eccdd77017f751c8efb11
parent 272065 31531f850dec8eb0131fd05c8b9a926cf9163b02
child 272067 7697a472772a9a4351de31f5d54bab8a5cb9c384
push id29659
push usercbook@mozilla.com
push dateWed, 11 Nov 2015 11:43:09 +0000
treeherdermozilla-central@84a7cf29f4f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1223310
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 1223310 (part 2) - Use LayoutDeviceIntRect for bounds-related functions in nsIWidget. r=kats. The patch renames the existing functions (GetBounds(), GetClientBounds(), etc) by adding an |Untyped| suffix. It then adds typed equivalents, and uses those typed equivalents in all the call sites where it's easy to do so. The trickier remaining call sites are converted to use the Untyped-suffix version.
accessible/generic/Accessible.cpp
docshell/base/nsDocShell.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsGlobalWindow.cpp
dom/events/EventStateManager.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
embedding/browser/nsWebBrowser.cpp
gfx/layers/client/ClientLayerManager.cpp
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d9/CompositorD3D9.cpp
gfx/layers/opengl/CompositorOGL.cpp
gfx/tests/gtest/TestCompositor.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsPresContext.cpp
layout/base/nsPresShell.cpp
layout/generic/nsFrame.cpp
layout/xul/PopupBoxObject.cpp
layout/xul/nsResizerFrame.cpp
layout/xul/nsTitleBarFrame.cpp
view/nsView.cpp
view/nsViewManager.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/gonk/HwcComposer2D.cpp
widget/gonk/nsAppShell.cpp
widget/gonk/nsScreenManagerGonk.cpp
widget/gonk/nsScreenManagerGonk.h
widget/gonk/nsWindow.cpp
widget/gonk/nsWindow.h
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
widget/nsIWidget.h
widget/nsNativeTheme.cpp
widget/qt/nsWindow.cpp
widget/qt/nsWindow.h
widget/uikit/nsWindow.h
widget/uikit/nsWindow.mm
widget/windows/IMMHandler.cpp
widget/windows/TSFTextStore.cpp
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
xpfe/appshell/nsWebShellWindow.cpp
xpfe/appshell/nsXULWindow.cpp
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -530,17 +530,17 @@ Accessible::ChildAtPoint(int32_t aX, int
   NS_ENSURE_TRUE(rootFrame, nullptr);
 
   nsIFrame* startFrame = rootFrame;
 
   // Check whether the point is at popup content.
   nsIWidget* rootWidget = rootFrame->GetView()->GetNearestWidget(nullptr);
   NS_ENSURE_TRUE(rootWidget, nullptr);
 
-  nsIntRect rootRect;
+  LayoutDeviceIntRect rootRect;
   rootWidget->GetScreenBounds(rootRect);
 
   WidgetMouseEvent dummyEvent(true, eMouseMove, rootWidget,
                               WidgetMouseEvent::eSynthesized);
   dummyEvent.refPoint = LayoutDeviceIntPoint(aX - rootRect.x, aY - rootRect.y);
 
   nsIFrame* popupFrame = nsLayoutUtils::
     GetPopupFrameForEventCoordinates(accDocument->PresContext()->GetRootPresContext(),
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5783,17 +5783,17 @@ nsDocShell::SetPositionAndSize(int32_t a
 }
 
 NS_IMETHODIMP
 nsDocShell::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aWidth,
                                int32_t* aHeight)
 {
   if (mParentWidget) {
     // ensure size is up-to-date if window has changed resolution
-    nsIntRect r;
+    LayoutDeviceIntRect r;
     mParentWidget->GetClientBounds(r);
     SetPositionAndSize(mBounds.x, mBounds.y, r.width, r.height, false);
   }
 
   // We should really consider just getting this information from
   // our window instead of duplicating the storage and code...
   if (aWidth || aHeight) {
     // Caller wants to know our size; make sure to give them up to
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1854,26 +1854,24 @@ nsDOMWindowUtils::SendQueryContentEvent(
   if (message == eQueryCharacterAtPoint) {
     // Looking for the widget at the point.
     WidgetQueryContentEvent dummyEvent(true, eQueryContentState, widget);
     dummyEvent.mUseNativeLineBreak = useNativeLineBreak;
     InitEvent(dummyEvent, &pt);
     nsIFrame* popupFrame =
       nsLayoutUtils::GetPopupFrameForEventCoordinates(presContext->GetRootPresContext(), &dummyEvent);
 
-    nsIntRect widgetBounds;
+    LayoutDeviceIntRect widgetBounds;
     nsresult rv = widget->GetClientBounds(widgetBounds);
     NS_ENSURE_SUCCESS(rv, rv);
     widgetBounds.MoveTo(0, 0);
 
     // There is no popup frame at the point and the point isn't in our widget,
     // we cannot process this request.
-    NS_ENSURE_TRUE(popupFrame ||
-                   widgetBounds.Contains(LayoutDeviceIntPoint::ToUntyped(pt)),
-                   NS_ERROR_FAILURE);
+    NS_ENSURE_TRUE(popupFrame || widgetBounds.Contains(pt), NS_ERROR_FAILURE);
 
     // Fire the event on the widget at the point
     if (popupFrame) {
       targetWidget = popupFrame->GetNearestWidget();
     }
   }
 
   pt += widget->WidgetToScreenOffset() - targetWidget->WidgetToScreenOffset();
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -13322,17 +13322,17 @@ nsGlobalWindow::NotifyDefaultButtonLoade
 
   // Get the widget rect in screen coordinates.
   nsIWidget *widget = GetNearestWidget();
   if (!widget) {
     aError.Throw(NS_ERROR_FAILURE);
     return;
   }
   nsIntRect widgetRect;
-  aError = widget->GetScreenBounds(widgetRect);
+  aError = widget->GetScreenBoundsUntyped(widgetRect);
   if (aError.Failed()) {
     return;
   }
 
   // Convert the buttonRect coordinates from screen to the widget.
   buttonRect -= widgetRect.TopLeft();
   nsresult rv = widget->OnDefaultButtonLoaded(buttonRect);
   if (NS_FAILED(rv) && rv != NS_ERROR_NOT_IMPLEMENTED) {
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -4139,17 +4139,17 @@ GetWindowInnerRectCenter(nsPIDOMWindow* 
 
   ErrorResult dummy;
   int32_t innerWidth = window->GetInnerWidthOuter(dummy);
   dummy.SuppressException();
 
   int32_t innerHeight = window->GetInnerHeightOuter(dummy);
   dummy.SuppressException();
 
-  nsIntRect screen;
+  LayoutDeviceIntRect screen;
   aWidget->GetScreenBounds(screen);
 
   int32_t cssScreenX = aContext->DevPixelsToIntCSSPixels(screen.x);
   int32_t cssScreenY = aContext->DevPixelsToIntCSSPixels(screen.y);
 
   return LayoutDeviceIntPoint(
     aContext->CSSPixelsToDevPixels(innerX - cssScreenX + innerWidth / 2),
     aContext->CSSPixelsToDevPixels(innerY - cssScreenY + innerHeight / 2));
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -840,17 +840,17 @@ NPBool nsPluginInstanceOwner::ConvertPoi
   nsIntSize intScreenDims = rootWidget->GetScreenDimensions();
   nsSize screenDims = nsSize(intScreenDims.width / scaleFactor,
                              intScreenDims.height / scaleFactor);
   int32_t screenH = screenDims.height;
   nsPoint windowPosition = AsNsPoint(rootWidget->GetWindowPosition()) / scaleFactor;
 
   // Window size is tab size + chrome size.
   nsIntRect tabContentBounds;
-  NS_ENSURE_SUCCESS(puppetWidget->GetBounds(tabContentBounds), false);
+  NS_ENSURE_SUCCESS(puppetWidget->GetBoundsUntyped(tabContentBounds), false);
   tabContentBounds.ScaleInverseRoundOut(scaleFactor);
   int32_t windowH = tabContentBounds.height + int(chromeSize.y);
 
   nsPoint pluginPosition = AsNsPoint(pluginFrame->GetScreenRect().TopLeft());
 
   // Convert (sourceX, sourceY) to 'real' (not PuppetWidget) screen space.
   // In OSX, the Y-axis increases upward, which is the reverse of ours.
   // We want OSX coordinates for window and screen so those equations are swapped.
@@ -946,17 +946,17 @@ NPBool nsPluginInstanceOwner::ConvertPoi
   if (!screen) {
     return false;
   }
 
   int32_t screenX, screenY, screenWidth, screenHeight;
   screen->GetRect(&screenX, &screenY, &screenWidth, &screenHeight);
   screenHeight /= scaleFactor;
 
-  nsIntRect windowScreenBounds;
+  LayoutDeviceIntRect windowScreenBounds;
   NS_ENSURE_SUCCESS(widget->GetScreenBounds(windowScreenBounds), false);
   windowScreenBounds.ScaleInverseRoundOut(scaleFactor);
   int32_t windowX = windowScreenBounds.x;
   int32_t windowY = windowScreenBounds.y;
   int32_t windowHeight = windowScreenBounds.height;
 
   nsIntRect pluginScreenRect = pluginFrame->GetScreenRect();
 
--- a/embedding/browser/nsWebBrowser.cpp
+++ b/embedding/browser/nsWebBrowser.cpp
@@ -1370,17 +1370,17 @@ nsWebBrowser::GetPositionAndSize(int32_t
     }
     if (aCX) {
       *aCX = mInitInfo->cx;
     }
     if (aCY) {
       *aCY = mInitInfo->cy;
     }
   } else if (mInternalWidget) {
-    nsIntRect bounds;
+    LayoutDeviceIntRect bounds;
     NS_ENSURE_SUCCESS(mInternalWidget->GetBounds(bounds), NS_ERROR_FAILURE);
 
     if (aX) {
       *aX = bounds.x;
     }
     if (aY) {
       *aY = bounds.y;
     }
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -198,17 +198,17 @@ ClientLayerManager::BeginTransactionWith
   dom::ScreenOrientationInternal orientation;
   if (dom::TabChild* window = mWidget->GetOwningTabChild()) {
     orientation = window->GetOrientation();
   } else {
     hal::ScreenConfiguration currentConfig;
     hal::GetCurrentScreenConfiguration(&currentConfig);
     orientation = currentConfig.orientation();
   }
-  IntRect targetBounds = mWidget->GetNaturalBounds();
+  IntRect targetBounds = mWidget->GetNaturalBoundsUntyped();
   targetBounds.x = targetBounds.y = 0;
   mForwarder->BeginTransaction(targetBounds, mTargetRotation, orientation);
 
   // If we're drawing on behalf of a context with async pan/zoom
   // enabled, then the entire buffer of painted layers might be
   // composited (including resampling) asynchronously before we get
   // a chance to repaint, so we have to ensure that it's all valid
   // and not rotated.
@@ -487,17 +487,17 @@ ClientLayerManager::MakeSnapshotIfRequir
     return;
   }
   if (mWidget) {
     if (CompositorChild* remoteRenderer = GetRemoteRenderer()) {
       // The compositor doesn't draw to a different sized surface
       // when there's a rotation. Instead we rotate the result
       // when drawing into dt
       IntRect outerBounds;
-      mWidget->GetBounds(outerBounds);
+      mWidget->GetBoundsUntyped(outerBounds);
 
       IntRect bounds = ToOutsideIntRect(mShadowTarget->GetClipExtents());
       if (mTargetRotation) {
         bounds = RotateRect(bounds, outerBounds, mTargetRotation);
       }
 
       SurfaceDescriptor inSnapshot;
       if (!bounds.IsEmpty() &&
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -964,17 +964,17 @@ LayerManagerComposite::RenderToPresentat
     surface = mirrorScreen->GetEGLSurface();
     if (surface == LOCAL_EGL_NO_SURFACE) {
       // Failed to create EGLSurface
       return;
     }
   }
   GLContext* gl = compositor->gl();
   GLContextEGL* egl = GLContextEGL::Cast(gl);
-  const IntSize windowSize = mirrorScreen->GetNaturalBounds().Size();
+  const IntSize windowSize = mirrorScreen->GetNaturalBoundsUntyped().Size();
 #endif
 
   if ((windowSize.width <= 0) || (windowSize.height <= 0)) {
     return;
   }
 
   ScreenRotation rotation = compositor->GetScreenRotation();
 
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -1197,17 +1197,17 @@ CompositorD3D11::PrepareViewport(const g
 
   memcpy(&mVSConstants.projection, &aProjection._11, sizeof(mVSConstants.projection));
 }
 
 void
 CompositorD3D11::EnsureSize()
 {
   IntRect rect;
-  mWidget->GetClientBounds(rect);
+  mWidget->GetClientBoundsUntyped(rect);
 
   mSize = rect.Size();
 }
 
 bool
 CompositorD3D11::VerifyBufferSize()
 {
   DXGI_SWAP_CHAIN_DESC swapDesc;
--- a/gfx/layers/d3d9/CompositorD3D9.cpp
+++ b/gfx/layers/d3d9/CompositorD3D9.cpp
@@ -698,17 +698,17 @@ CompositorD3D9::PrepareViewport(const gf
     NS_WARNING("Failed to set projection matrix");
   }
 }
 
 void
 CompositorD3D9::EnsureSize()
 {
   IntRect rect;
-  mWidget->GetClientBounds(rect);
+  mWidget->GetClientBoundsUntyped(rect);
 
   mSize = rect.Size();
 }
 
 void
 CompositorD3D9::SetSamplerForFilter(Filter aFilter)
 {
   switch (aFilter) {
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -1385,19 +1385,19 @@ CompositorOGL::EndFrame()
 {
   PROFILER_LABEL("CompositorOGL", "EndFrame",
     js::ProfileEntry::Category::GRAPHICS);
 
   MOZ_ASSERT(mCurrentRenderTarget == mWindowRenderTarget, "Rendering target not properly restored");
 
 #ifdef MOZ_DUMP_PAINTING
   if (gfxEnv::DumpCompositorTextures()) {
-    IntRect rect;
+    LayoutDeviceIntRect rect;
     if (mUseExternalSurfaceSize) {
-      rect = IntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
+      rect = LayoutDeviceIntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
     } else {
       mWidget->GetBounds(rect);
     }
     RefPtr<DrawTarget> target = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(rect.width, rect.height), SurfaceFormat::B8G8R8A8);
     if (target) {
       CopyToTarget(target, nsIntPoint(), Matrix());
       WriteSnapshotToDumpFile(this, target);
     }
--- a/gfx/tests/gtest/TestCompositor.cpp
+++ b/gfx/tests/gtest/TestCompositor.cpp
@@ -29,21 +29,23 @@ using namespace mozilla::gl;
 
 class MockWidget : public nsBaseWidget
 {
 public:
   MockWidget() {}
 
   NS_DECL_ISUPPORTS_INHERITED
 
-  NS_IMETHOD              GetClientBounds(IntRect &aRect) override {
+  NS_IMETHOD GetClientBoundsUntyped(IntRect &aRect) override {
     aRect = IntRect(0, 0, gCompWidth, gCompHeight);
     return NS_OK;
   }
-  NS_IMETHOD              GetBounds(IntRect &aRect) override { return GetClientBounds(aRect); }
+  NS_IMETHOD GetBoundsUntyped(IntRect &aRect) override {
+    return GetClientBoundsUntyped(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(
         IntSize(gCompWidth, gCompHeight), caps,
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2884,19 +2884,19 @@ nsLayoutUtils::TransformFrameRectToAnces
 static LayoutDeviceIntPoint GetWidgetOffset(nsIWidget* aWidget, nsIWidget*& aRootWidget) {
   LayoutDeviceIntPoint offset(0, 0);
   while ((aWidget->WindowType() == eWindowType_child ||
           aWidget->IsPlugin())) {
     nsIWidget* parent = aWidget->GetParent();
     if (!parent) {
       break;
     }
-    nsIntRect bounds;
+    LayoutDeviceIntRect bounds;
     aWidget->GetBounds(bounds);
-    offset += LayoutDeviceIntPoint::FromUntyped(bounds.TopLeft());
+    offset += bounds.TopLeft();
     aWidget = parent;
   }
   aRootWidget = aWidget;
   return offset;
 }
 
 static LayoutDeviceIntPoint
 WidgetToWidgetOffset(nsIWidget* aFrom, nsIWidget* aTo) {
@@ -7974,17 +7974,17 @@ UpdateCompositionBoundsForRCDRSF(ParentL
   nsIWidget* widget = rootFrame->GetNearestWidget();
 #else
   nsView* view = rootFrame->GetView();
   nsIWidget* widget = view ? view->GetWidget() : nullptr;
 #endif
 
   if (widget) {
     nsIntRect widgetBounds;
-    widget->GetBounds(widgetBounds);
+    widget->GetBoundsUntyped(widgetBounds);
     widgetBounds.MoveTo(0, 0);
     aCompBounds = ParentLayerRect(ViewAs<ParentLayerPixel>(widgetBounds));
     return true;
   }
 
   LayoutDeviceIntSize contentSize;
   if (nsLayoutUtils::GetContentViewerSize(aPresContext, contentSize)) {
     LayoutDeviceToParentLayerScale scale;
@@ -8099,17 +8099,17 @@ nsLayoutUtils::CalculateRootCompositionS
           (LayoutDeviceRect::FromAppUnits(rootFrame->GetRect(), rootAUPerDevPixel)
            * cumulativeResolution).Size();
         rootCompositionSize = frameSize * LayerToScreenScale(1.0f);
       }
     }
   } else {
     nsIWidget* widget = aFrame->GetNearestWidget();
     nsIntRect widgetBounds;
-    widget->GetBounds(widgetBounds);
+    widget->GetBoundsUntyped(widgetBounds);
     rootCompositionSize = ScreenSize(ViewAs<ScreenPixel>(widgetBounds.Size()));
   }
 
   // Adjust composition size for the size of scroll bars.
   nsIFrame* rootRootScrollFrame = rootPresShell ? rootPresShell->GetRootScrollFrame() : nullptr;
   nsMargin scrollbarMargins = ScrollbarAreaToExcludeFromCompositionBoundsFor(rootRootScrollFrame);
   LayoutDeviceMargin margins = LayoutDeviceMargin::FromAppUnits(scrollbarMargins,
     rootPresContext->AppUnitsPerDevPixel());
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -3123,17 +3123,17 @@ SortConfigurations(nsTArray<nsIWidget::C
     uint32_t i;
     for (i = 0; i + 1 < pluginsToMove.Length(); ++i) {
       nsIWidget::Configuration* config = &pluginsToMove[i];
       bool foundOverlap = false;
       for (uint32_t j = 0; j < pluginsToMove.Length(); ++j) {
         if (i == j)
           continue;
         nsIntRect bounds;
-        pluginsToMove[j].mChild->GetBounds(bounds);
+        pluginsToMove[j].mChild->GetBoundsUntyped(bounds);
         nsAutoTArray<nsIntRect,1> clipRects;
         pluginsToMove[j].mChild->GetWindowClipRegion(&clipRects);
         if (HasOverlap(bounds.TopLeft(), clipRects,
                        config->mBounds.TopLeft(),
                        config->mClipRegion)) {
           foundOverlap = true;
           break;
         }
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -9678,18 +9678,18 @@ CompareTrees(nsPresContext* aFirstPresCo
           nsIWidget* w1 = v1->GetWidget();
           nsIWidget* w2 = v2->GetWidget();
           if (((nullptr == w1) && (nullptr != w2)) ||
               ((nullptr != w1) && (nullptr == w2))) {
             ok = false;
             LogVerifyMessage(k1, k2, "child widgets are not matched\n");
           }
           else if (nullptr != w1) {
-            w1->GetBounds(r1);
-            w2->GetBounds(r2);
+            w1->GetBoundsUntyped(r1);
+            w2->GetBoundsUntyped(r2);
             if (!r1.IsEqualEdges(r2)) {
               LogVerifyMessage(k1, k2, "(widget rects)", r1, r2);
             }
           }
         }
         if (!ok && (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags))) {
           break;
         }
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -5051,21 +5051,22 @@ nsIFrame::GetTransformMatrix(const nsIFr
     nsIWidget* widget = GetView()->GetWidget();
     nsPresContext* rootPresContext = PresContext()->GetRootPresContext();
     // Maybe the widget hasn't been created yet? Popups without widgets are
     // treated as regular frames. That should work since they'll be rendered
     // as part of the page if they're rendered at all.
     if (widget && rootPresContext) {
       nsIWidget* toplevel = rootPresContext->GetNearestWidget();
       if (toplevel) {
-        nsIntRect screenBounds;
+        LayoutDeviceIntRect screenBounds;
         widget->GetClientBounds(screenBounds);
-        nsIntRect toplevelScreenBounds;
+        LayoutDeviceIntRect toplevelScreenBounds;
         toplevel->GetClientBounds(toplevelScreenBounds);
-        nsIntPoint translation = screenBounds.TopLeft() - toplevelScreenBounds.TopLeft();
+        LayoutDeviceIntPoint translation =
+          screenBounds.TopLeft() - toplevelScreenBounds.TopLeft();
 
         Matrix4x4 transformToTop;
         transformToTop._41 = translation.x;
         transformToTop._42 = translation.y;
 
         *aOutAncestor = docRootFrame;
         Matrix4x4 docRootTransformToTop =
           nsLayoutUtils::GetTransformToAncestor(docRootFrame, nullptr);
--- a/layout/xul/PopupBoxObject.cpp
+++ b/layout/xul/PopupBoxObject.cpp
@@ -279,17 +279,17 @@ PopupBoxObject::GetOuterScreenRect()
     return rect.forget();
   }
 
   nsView* view = menuPopupFrame->GetView();
   if (view) {
     nsIWidget* widget = view->GetWidget();
     if (widget) {
       nsIntRect screenRect;
-      widget->GetScreenBounds(screenRect);
+      widget->GetScreenBoundsUntyped(screenRect);
 
       int32_t pp = menuPopupFrame->PresContext()->AppUnitsPerDevPixel();
       rect->SetLayoutRect(ToAppUnits(screenRect, pp));
     }
   }
   return rect.forget();
 }
 
--- a/layout/xul/nsResizerFrame.cpp
+++ b/layout/xul/nsResizerFrame.cpp
@@ -240,17 +240,17 @@ nsResizerFrame::HandleEvent(nsPresContex
         // the resizer invisible.
         nsRect appUnitsRect = ToAppUnits(LayoutDevicePixel::ToUntyped(rect), aPresContext->AppUnitsPerDevPixel());
         if (appUnitsRect.width < mRect.width && mouseMove.x)
           appUnitsRect.width = mRect.width;
         if (appUnitsRect.height < mRect.height && mouseMove.y)
           appUnitsRect.height = mRect.height;
         nsIntRect cssRect = appUnitsRect.ToInsidePixels(nsPresContext::AppUnitsPerCSSPixel());
 
-        nsIntRect oldRect;
+        LayoutDeviceIntRect oldRect;
         nsWeakFrame weakFrame(menuPopupFrame);
         if (menuPopupFrame) {
           nsCOMPtr<nsIWidget> widget = menuPopupFrame->GetWidget();
           if (widget)
             widget->GetScreenBounds(oldRect);
 
           // convert the new rectangle into outer window coordinates
           nsIntPoint clientOffset = widget->GetClientOffset();
--- a/layout/xul/nsTitleBarFrame.cpp
+++ b/layout/xul/nsTitleBarFrame.cpp
@@ -120,20 +120,20 @@ nsTitleBarFrame::HandleEvent(nsPresConte
            parent = parent->GetParent();
          }
 
          // if the titlebar is in a popup, move the popup frame, otherwise
          // move the widget associated with the window
          if (parent) {
            nsMenuPopupFrame* menuPopupFrame = static_cast<nsMenuPopupFrame*>(parent);
            nsCOMPtr<nsIWidget> widget = menuPopupFrame->GetWidget();
-           nsIntRect bounds;
+           LayoutDeviceIntRect bounds;
            widget->GetScreenBounds(bounds);
 
-           CSSPoint cssPos = (LayoutDeviceIntPoint::FromUntyped(bounds.TopLeft()) + nsMoveBy)
+           CSSPoint cssPos = (bounds.TopLeft() + nsMoveBy)
                            / aPresContext->CSSToDevPixelScale();
            menuPopupFrame->MoveTo(RoundedToInt(cssPos), false);
          }
          else {
            nsIPresShell* presShell = aPresContext->PresShell();
            nsPIDOMWindow *window = presShell->GetDocument()->GetWindow();
            if (window) {
              window->MoveBy(nsMoveBy.x, nsMoveBy.y);
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -299,17 +299,17 @@ void nsView::DoResetWidgetBounds(bool aM
   // Stash a copy of these and use them so we can handle this being deleted (say
   // from sync painting/flushing from Show/Move/Resize on the widget).
   nsIntRect newBounds;
   RefPtr<nsDeviceContext> dx = mViewManager->GetDeviceContext();
 
   nsWindowType type = widget->WindowType();
 
   nsIntRect curBounds;
-  widget->GetClientBounds(curBounds);
+  widget->GetClientBoundsUntyped(curBounds);
   bool invisiblePopup = type == eWindowType_popup &&
                         ((curBounds.IsEmpty() && mDimBounds.IsEmpty()) ||
                          mVis == nsViewVisibility_kHide);
 
   if (invisiblePopup) {
     // We're going to hit the early exit below, avoid calling CalcWidgetBounds.
   } else {
     newBounds = CalcWidgetBounds(type);
@@ -797,19 +797,19 @@ void nsView::DetachWidgetEventHandler(ns
 void nsView::List(FILE* out, int32_t aIndent) const
 {
   int32_t i;
   for (i = aIndent; --i >= 0; ) fputs("  ", out);
   fprintf(out, "%p ", (void*)this);
   if (nullptr != mWindow) {
     nscoord p2a = mViewManager->AppUnitsPerDevPixel();
     nsIntRect rect;
-    mWindow->GetClientBounds(rect);
+    mWindow->GetClientBoundsUntyped(rect);
     nsRect windowBounds = ToAppUnits(rect, p2a);
-    mWindow->GetBounds(rect);
+    mWindow->GetBoundsUntyped(rect);
     nsRect nonclientBounds = ToAppUnits(rect, p2a);
     nsrefcnt widgetRefCnt = mWindow.get()->AddRef() - 1;
     mWindow.get()->Release();
     int32_t Z = mWindow->GetZIndex();
     fprintf(out, "(widget=%p[%" PRIuPTR "] z=%d pos={%d,%d,%d,%d}) ",
             (void*)mWindow, widgetRefCnt, Z,
             nonclientBounds.x, nonclientBounds.y,
             windowBounds.width, windowBounds.height);
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -581,17 +581,17 @@ nsViewManager::InvalidateWidgetArea(nsVi
 
         // We do not need to invalidate in plugin widgets, but we should
         // exclude them from the invalidation region IF we're not on
         // Mac. On Mac we need to draw under plugin widgets, because
         // plugin widgets are basically invisible
 #ifndef XP_MACOSX
         // GetBounds should compensate for chrome on a toplevel widget
         nsIntRect bounds;
-        childWidget->GetBounds(bounds);
+        childWidget->GetBoundsUntyped(bounds);
 
         nsTArray<nsIntRect> clipRects;
         childWidget->GetWindowClipRegion(&clipRects);
         for (uint32_t i = 0; i < clipRects.Length(); ++i) {
           nsRect rr = ToAppUnits(clipRects[i] + bounds.TopLeft(), AppUnitsPerDevPixel());
           children.Or(children, rr - aWidgetView->ViewToWidgetOffset());
           children.SimplifyInward(20);
         }
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -236,17 +236,17 @@ PuppetWidget::ConfigureChildren(const ns
 {
   for (uint32_t i = 0; i < aConfigurations.Length(); ++i) {
     const Configuration& configuration = aConfigurations[i];
     PuppetWidget* w = static_cast<PuppetWidget*>(configuration.mChild.get());
     NS_ASSERTION(w->GetParent() == this,
                  "Configured widget is not a child");
     w->SetWindowClipRegion(configuration.mClipRegion, true);
     nsIntRect bounds;
-    w->GetBounds(bounds);
+    w->GetBoundsUntyped(bounds);
     if (bounds.Size() != configuration.mBounds.Size()) {
       w->Resize(configuration.mBounds.x, configuration.mBounds.y,
                 configuration.mBounds.width, configuration.mBounds.height,
                 true);
     } else if (bounds.TopLeft() != configuration.mBounds.TopLeft()) {
       w->Move(configuration.mBounds.x, configuration.mBounds.y);
     }
     w->SetWindowClipRegion(configuration.mClipRegion, false);
@@ -1166,18 +1166,18 @@ 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::GetScreenBounds(nsIntRect &aRect) {
-  aRect.MoveTo(LayoutDeviceIntPoint::ToUntyped(WidgetToScreenOffset()));
+PuppetWidget::GetScreenBoundsUntyped(nsIntRect &aRect) {
+  aRect.MoveTo(WidgetToScreenOffsetUntyped());
   aRect.SizeTo(mBounds.Size());
   return NS_OK;
 }
 
 uint32_t PuppetWidget::GetMaxTouchPoints() const
 {
   static uint32_t sTouchPoints = 0;
   static bool sIsInitialized = false;
--- 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 GetScreenBounds(nsIntRect &aRect) override;
+  NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &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
@@ -947,17 +947,17 @@ nsWindow::BringToFront()
     }
 
     // force a window resize
     nsAppShell::gAppShell->ResendLastResizeEvent(newTop);
     RedrawAll();
 }
 
 NS_IMETHODIMP
-nsWindow::GetScreenBounds(nsIntRect &aRect)
+nsWindow::GetScreenBoundsUntyped(nsIntRect &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
@@ -99,17 +99,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 GetScreenBounds(nsIntRect &aRect) override;
+    NS_IMETHOD GetScreenBoundsUntyped(nsIntRect &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              GetBounds(nsIntRect &aRect) override;
-  NS_IMETHOD              GetClientBounds(nsIntRect &aRect) override;
-  NS_IMETHOD              GetScreenBounds(nsIntRect &aRect) override;
+  NS_IMETHOD              GetBoundsUntyped(nsIntRect &aRect) override;
+  NS_IMETHOD              GetClientBoundsUntyped(nsIntRect &aRect) override;
+  NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &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,40 +901,40 @@ 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::GetBounds(nsIntRect &aRect)
+NS_IMETHODIMP nsChildView::GetBoundsUntyped(nsIntRect &aRect)
 {
   if (!mView) {
     aRect = mBounds;
   } else {
     aRect = CocoaPointsToDevPixels([mView frame]);
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP nsChildView::GetClientBounds(nsIntRect &aRect)
-{
-  GetBounds(aRect);
+NS_IMETHODIMP nsChildView::GetClientBoundsUntyped(nsIntRect &aRect)
+{
+  GetBoundsUntyped(aRect);
   if (!mParentWidget) {
     // For top level widgets we want the position on screen, not the position
     // of this view inside the window.
     aRect.MoveTo(WidgetToScreenOffsetUntyped());
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP nsChildView::GetScreenBounds(nsIntRect &aRect)
-{
-  GetBounds(aRect);
+NS_IMETHODIMP nsChildView::GetScreenBoundsUntyped(nsIntRect &aRect)
+{
+  GetBoundsUntyped(aRect);
   aRect.MoveTo(WidgetToScreenOffsetUntyped());
   return NS_OK;
 }
 
 double
 nsChildView::GetDefaultScaleInternal()
 {
   return BackingScaleFactor();
@@ -3667,17 +3667,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
 }
 
 - (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext
 {
   if (!mGeckoChild || !mGeckoChild->IsVisible())
     return;
 
 #ifdef DEBUG_UPDATE
-  nsIntRect geckoBounds;
+  LayoutDeviceIntRect geckoBounds;
   mGeckoChild->GetBounds(geckoBounds);
 
   fprintf (stderr, "---- Update[%p][%p] [%f %f %f %f] cgc: %p\n  gecko bounds: [%d %d %d %d]\n",
            self, mGeckoChild,
            aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height, aContext,
            geckoBounds.x, geckoBounds.y, geckoBounds.width, geckoBounds.height);
 
   CGAffineTransform xform = CGContextGetCTM(aContext);
@@ -3816,17 +3816,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
     js::ProfileEntry::Category::GRAPHICS);
 
   if (![self isUsingOpenGL] || !mGeckoChild->IsVisible())
     return;
 
   mWaitingForPaint = NO;
 
   nsIntRect geckoBounds;
-  mGeckoChild->GetBounds(geckoBounds);
+  mGeckoChild->GetBoundsUntyped(geckoBounds);
   nsIntRegion region(geckoBounds);
 
   mGeckoChild->PaintWindow(region);
 
   // Force OpenGL to refresh the very first time we draw. This works around a
   // Mac OS X bug that stops windows updating on OS X when we use OpenGL.
   if (!mDidForceRefreshOpenGL) {
     [self performSelector:@selector(forceRefreshOpenGL) withObject:nil afterDelay:0];
--- 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              GetClientBounds(nsIntRect &aRect) override;
-    NS_IMETHOD              GetScreenBounds(nsIntRect &aRect) override;
+    NS_IMETHOD              GetClientBoundsUntyped(nsIntRect &aRect) override;
+    NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &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,17 +1545,17 @@ 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::GetClientBounds(nsIntRect &aRect)
+NS_IMETHODIMP nsCocoaWindow::GetClientBoundsUntyped(nsIntRect &aRect)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   CGFloat scaleFactor = BackingScaleFactor();
   if (!mWindow) {
     aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor);
     return NS_OK;
   }
@@ -1580,17 +1580,17 @@ nsCocoaWindow::UpdateBounds()
 {
   NSRect frame = NSZeroRect;
   if (mWindow) {
     frame = [mWindow frame];
   }
   mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
 }
 
-NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(nsIntRect &aRect)
+NS_IMETHODIMP nsCocoaWindow::GetScreenBoundsUntyped(nsIntRect &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
 
@@ -1909,17 +1909,17 @@ nsCocoaWindow::DispatchSizeModeEvent()
 void
 nsCocoaWindow::ReportSizeEvent()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   UpdateBounds();
 
   if (mWidgetListener) {
-    nsIntRect innerBounds;
+    LayoutDeviceIntRect innerBounds;
     GetClientBounds(innerBounds);
     mWidgetListener->WindowResized(this, innerBounds.width, innerBounds.height);
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 void nsCocoaWindow::SetMenuBar(nsMenuBarX *aMenuBar)
@@ -1978,17 +1978,17 @@ LayoutDeviceIntPoint nsCocoaWindow::Widg
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
 }
 
 nsIntPoint nsCocoaWindow::GetClientOffset()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   nsIntRect clientRect;
-  GetClientBounds(clientRect);
+  GetClientBoundsUntyped(clientRect);
 
   return clientRect.TopLeft() - mBounds.TopLeft();
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nsIntPoint(0, 0));
 }
 
 LayoutDeviceIntSize
 nsCocoaWindow::ClientToWindowSize(const LayoutDeviceIntSize& aClientSize)
--- a/widget/gonk/HwcComposer2D.cpp
+++ b/widget/gonk/HwcComposer2D.cpp
@@ -765,17 +765,17 @@ HwcComposer2D::Render(nsIWidget* aWidget
     }
 
     if (mPrepared) {
         // No mHwc prepare, if already prepared in current draw cycle
         mList->hwLayers[mList->numHwLayers - 1].handle = dispSurface->lastHandle;
         mList->hwLayers[mList->numHwLayers - 1].acquireFenceFd = dispSurface->GetPrevDispAcquireFd();
     } else {
         // Update screen rect to handle a case that TryRenderWithHwc() is not called.
-        mScreenRect = screen->GetNaturalBounds();
+        mScreenRect = screen->GetNaturalBoundsUntyped();
 
         mList->flags = HWC_GEOMETRY_CHANGED;
         mList->numHwLayers = 2;
         mList->hwLayers[0].hints = 0;
         mList->hwLayers[0].compositionType = HWC_FRAMEBUFFER;
         mList->hwLayers[0].flags = HWC_SKIP_LAYER;
         mList->hwLayers[0].backgroundColor = {0};
         mList->hwLayers[0].acquireFenceFd = -1;
@@ -887,17 +887,17 @@ HwcComposer2D::TryRenderWithHwc(Layer* a
         mHal->ResetHwc();
         mPrepared = false;
     }
 
     // XXX: The clear() below means all rect vectors will be have to be
     // reallocated. We may want to avoid this if possible
     mVisibleRegions.clear();
 
-    mScreenRect = screen->GetNaturalBounds();
+    mScreenRect = screen->GetNaturalBoundsUntyped();
     MOZ_ASSERT(mHwcLayerMap.IsEmpty());
     if (!PrepareLayerList(aRoot,
                           mScreenRect,
                           gfx::Matrix()))
     {
         mHwcLayerMap.Clear();
         LOGD("Render aborted. Nothing was drawn to the screen");
         return false;
--- a/widget/gonk/nsAppShell.cpp
+++ b/widget/gonk/nsAppShell.cpp
@@ -575,17 +575,17 @@ GeckoInputReaderPolicy::setDisplayInfo()
                   static_cast<int>(DISPLAY_ORIENTATION_270),
                   "Orientation enums not matched!");
 
     RefPtr<nsScreenGonk> screen = nsScreenManagerGonk::GetPrimaryScreen();
 
     uint32_t rotation = nsIScreen::ROTATION_0_DEG;
     DebugOnly<nsresult> rv = screen->GetRotation(&rotation);
     MOZ_ASSERT(NS_SUCCEEDED(rv));
-    nsIntRect screenBounds = screen->GetNaturalBounds();
+    nsIntRect screenBounds = screen->GetNaturalBoundsUntyped();
 
     DisplayViewport viewport;
     viewport.displayId = 0;
     viewport.orientation = rotation;
     viewport.physicalRight = viewport.deviceWidth = screenBounds.width;
     viewport.physicalBottom = viewport.deviceHeight = screenBounds.height;
     if (viewport.orientation == DISPLAY_ORIENTATION_90 ||
         viewport.orientation == DISPLAY_ORIENTATION_270) {
--- a/widget/gonk/nsScreenManagerGonk.cpp
+++ b/widget/gonk/nsScreenManagerGonk.cpp
@@ -277,17 +277,17 @@ nsScreenGonk::SetRotation(uint32_t aRota
                                mVirtualBounds.height,
                                true);
     }
 
     return NS_OK;
 }
 
 nsIntRect
-nsScreenGonk::GetNaturalBounds()
+nsScreenGonk::GetNaturalBoundsUntyped()
 {
     return mNaturalBounds;
 }
 
 uint32_t
 nsScreenGonk::EffectiveScreenRotation()
 {
     return (mScreenRotation + mPhysicalScreenRotation) % (360 / 90);
--- a/widget/gonk/nsScreenManagerGonk.h
+++ b/widget/gonk/nsScreenManagerGonk.h
@@ -64,17 +64,17 @@ public:
     NS_IMETHOD GetRotation(uint32_t* aRotation);
     NS_IMETHOD SetRotation(uint32_t  aRotation);
 
     uint32_t GetId();
     nsIntRect GetRect();
     float GetDpi();
     int32_t GetSurfaceFormat();
     ANativeWindow* GetNativeWindow();
-    nsIntRect GetNaturalBounds();
+    nsIntRect GetNaturalBoundsUntyped();
     uint32_t EffectiveScreenRotation();
     ScreenConfiguration GetConfiguration();
     bool IsPrimaryScreen();
 
     ANativeWindowBuffer* DequeueBuffer();
     bool QueueBuffer(ANativeWindowBuffer* buf);
 
 #if ANDROID_VERSION >= 17
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -847,19 +847,19 @@ nsWindow::GetGLFrameBufferFormat()
         // We directly map the hardware fb on Gonk.  The hardware fb
         // has RGB format.
         return LOCAL_GL_RGB;
     }
     return LOCAL_GL_NONE;
 }
 
 nsIntRect
-nsWindow::GetNaturalBounds()
+nsWindow::GetNaturalBoundsUntyped()
 {
-    return mScreen->GetNaturalBounds();
+    return mScreen->GetNaturalBoundsUntyped();
 }
 
 nsScreenGonk*
 nsWindow::GetScreen()
 {
     return mScreen;
 }
 
--- a/widget/gonk/nsWindow.h
+++ b/widget/gonk/nsWindow.h
@@ -118,17 +118,17 @@ public:
     virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight);
 
     NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
                                       const InputContextAction& aAction);
     NS_IMETHOD_(InputContext) GetInputContext();
 
     virtual uint32_t GetGLFrameBufferFormat() override;
 
-    virtual nsIntRect GetNaturalBounds() override;
+    virtual nsIntRect GetNaturalBoundsUntyped() override;
     virtual bool NeedsPaint();
 
     virtual Composer2D* GetComposer2D() override;
 
     void ConfigureAPZControllerThread() override;
 
     nsScreenGonk* GetScreen();
 
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1465,50 +1465,50 @@ nsWindow::SetFocus(bool aRaise)
 
     LOGFOCUS(("  widget now has focus in SetFocus() [%p]\n",
               (void *)this));
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWindow::GetScreenBounds(nsIntRect &aRect)
+nsWindow::GetScreenBoundsUntyped(nsIntRect &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(LayoutDevicePixel::ToUntyped(GdkPointToDevicePixels({ x, y })));
     }
     else {
         aRect.MoveTo(WidgetToScreenOffsetUntyped());
     }
     // 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(("GetScreenBounds %d,%d | %dx%d\n",
+    LOG(("GetScreenBoundsUntyped %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::GetClientBounds(nsIntRect &aRect)
+nsWindow::GetClientBoundsUntyped(nsIntRect &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).
-    GetBounds(aRect);
+    GetBoundsUntyped(aRect);
     aRect.MoveBy(GetClientOffset());
 
     return NS_OK;
 }
 
 void
 nsWindow::UpdateClientOffset()
 {
@@ -2182,17 +2182,17 @@ nsWindow::OnExposeEvent(cairo_t *cr)
             gdk_window_peek_children(mGdkWindow);
         while (children) {
             GdkWindow *gdkWin = GDK_WINDOW(children->data);
             nsWindow *kid = get_window_for_gdk_window(gdkWin);
             if (kid && gdk_window_is_visible(gdkWin)) {
                 nsAutoTArray<nsIntRect,1> clipRects;
                 kid->GetWindowClipRegion(&clipRects);
                 nsIntRect bounds;
-                kid->GetBounds(bounds);
+                kid->GetBoundsUntyped(bounds);
                 for (uint32_t i = 0; i < clipRects.Length(); ++i) {
                     nsIntRect r = clipRects[i] + bounds.TopLeft();
                     region.Sub(region, r);
                 }
             }
             children = children->next;
         }
     }
@@ -2358,17 +2358,17 @@ nsWindow::OnConfigureEvent(GtkWidget *aW
     //
     //   Override-redirect windows are children of the root window so parent
     //   coordinates are root coordinates.
 
     LOG(("configure event [%p] %d %d %d %d\n", (void *)this,
          aEvent->x, aEvent->y, aEvent->width, aEvent->height));
 
     nsIntRect screenBounds;
-    GetScreenBounds(screenBounds);
+    GetScreenBoundsUntyped(screenBounds);
 
     if (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog) {
         // This check avoids unwanted rollup on spurious configure events from
         // Cygwin/X (bug 672103).
         if (mBounds.x != screenBounds.x ||
             mBounds.y != screenBounds.y) {
             CheckForRollup(0, 0, false, true);
         }
--- 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         GetScreenBounds(nsIntRect &aRect) override;
-    NS_IMETHOD         GetClientBounds(nsIntRect &aRect) override;
+    NS_IMETHOD         GetScreenBoundsUntyped(nsIntRect &aRect) override;
+    NS_IMETHOD         GetClientBoundsUntyped(nsIntRect &aRect) override;
     virtual mozilla::gfx::IntSize GetClientSize() override;
     virtual nsIntPoint GetClientOffset() 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
@@ -857,17 +857,17 @@ nsBaseWidget::ComputeShouldAccelerate()
 CompositorParent* nsBaseWidget::NewCompositorParent(int aSurfaceWidth,
                                                     int aSurfaceHeight)
 {
   return new CompositorParent(this, false, aSurfaceWidth, aSurfaceHeight);
 }
 
 void nsBaseWidget::CreateCompositor()
 {
-  nsIntRect rect;
+  LayoutDeviceIntRect rect;
   GetBounds(rect);
   CreateCompositor(rect.width, rect.height);
 }
 
 already_AddRefed<GeckoContentController>
 nsBaseWidget::CreateRootContentController()
 {
   RefPtr<GeckoContentController> controller = new ChromeProcessController(this, mAPZEventState, mAPZC);
@@ -1254,17 +1254,17 @@ NS_METHOD nsBaseWidget::MoveClient(doubl
 
 NS_METHOD nsBaseWidget::ResizeClient(double aWidth,
                                      double aHeight,
                                      bool aRepaint)
 {
   NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
   NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
 
-  nsIntRect clientBounds;
+  LayoutDeviceIntRect clientBounds;
   GetClientBounds(clientBounds);
 
   // GetClientBounds and mBounds are device pixels; scale back to display pixels
   // if that's what this widget uses for the Move/Resize APIs
   CSSToLayoutDeviceScale scale = BoundsUseDisplayPixels()
                                     ? GetDefaultScale()
                                     : CSSToLayoutDeviceScale(1.0);
   double invScale = 1.0 / scale.scale;
@@ -1278,17 +1278,17 @@ NS_METHOD nsBaseWidget::ResizeClient(dou
                                      double aY,
                                      double aWidth,
                                      double aHeight,
                                      bool aRepaint)
 {
   NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
   NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
 
-  nsIntRect clientBounds;
+  LayoutDeviceIntRect clientBounds;
   GetClientBounds(clientBounds);
 
   double scale = BoundsUseDisplayPixels() ? 1.0 / GetDefaultScale().scale : 1.0;
   aWidth = mBounds.width * scale + (aWidth - clientBounds.width * scale);
   aHeight = mBounds.height * scale + (aHeight - clientBounds.height * scale);
 
   nsIntPoint clientOffset(GetClientOffset());
   aX -= clientOffset.x * scale;
@@ -1302,47 +1302,47 @@ NS_METHOD nsBaseWidget::ResizeClient(dou
 // Bounds
 //
 //-------------------------------------------------------------------------
 
 /**
 * If the implementation of nsWindow supports borders this method MUST be overridden
 *
 **/
-NS_METHOD nsBaseWidget::GetClientBounds(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetClientBoundsUntyped(nsIntRect &aRect)
 {
-  return GetBounds(aRect);
+  return GetBoundsUntyped(aRect);
 }
 
 /**
 * If the implementation of nsWindow supports borders this method MUST be overridden
 *
 **/
-NS_METHOD nsBaseWidget::GetBounds(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetBoundsUntyped(nsIntRect &aRect)
 {
   aRect = 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::GetScreenBounds(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetScreenBoundsUntyped(nsIntRect &aRect)
 {
-  return GetBounds(aRect);
+  return GetBoundsUntyped(aRect);
 }
 
-NS_METHOD nsBaseWidget::GetRestoredBounds(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetRestoredBoundsUntyped(nsIntRect &aRect)
 {
   if (SizeMode() != nsSizeMode_Normal) {
     return NS_ERROR_FAILURE;
   }
-  return GetScreenBounds(aRect);
+  return GetScreenBoundsUntyped(aRect);
 }
 
 nsIntPoint nsBaseWidget::GetClientOffset()
 {
   return nsIntPoint(0, 0);
 }
 
 NS_IMETHODIMP
@@ -1720,17 +1720,17 @@ nsBaseWidget::StartAsyncScrollbarDrag(co
   APZThreadUtils::RunOnControllerThread(
     NewRunnableMethod(mAPZC.get(), &APZCTreeManager::StartScrollbarDrag, guid, aDragMetrics));
 }
 
 nsIntRect
 nsBaseWidget::GetScaledScreenBounds()
 {
   nsIntRect bounds;
-  GetScreenBounds(bounds);
+  GetScreenBoundsUntyped(bounds);
   CSSToLayoutDeviceScale scale = GetDefaultScale();
   bounds.x = NSToIntRound(bounds.x / scale.scale);
   bounds.y = NSToIntRound(bounds.y / scale.scale);
   bounds.width = NSToIntRound(bounds.width / scale.scale);
   bounds.height = NSToIntRound(bounds.height / scale.scale);
   return bounds;
 }
 
@@ -1964,17 +1964,17 @@ nsIWidget::SnapshotWidgetOnScreen()
     return nullptr;
   }
 
   CompositorChild* cc = lm->GetRemoteRenderer();
   if (!cc) {
     return nullptr;
   }
 
-  nsIntRect bounds;
+  LayoutDeviceIntRect bounds;
   GetBounds(bounds);
   if (bounds.IsEmpty()) {
     return nullptr;
   }
 
   gfx::IntSize size(bounds.width, bounds.height);
 
   ShadowLayerForwarder* forwarder = lm->AsShadowForwarder();
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -182,20 +182,20 @@ 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              GetBounds(nsIntRect &aRect) override;
-  NS_IMETHOD              GetClientBounds(nsIntRect &aRect) override;
-  NS_IMETHOD              GetScreenBounds(nsIntRect &aRect) override;
-  NS_IMETHOD              GetRestoredBounds(nsIntRect &aRect) override;
+  NS_IMETHOD              GetBoundsUntyped(nsIntRect &aRect) override;
+  NS_IMETHOD              GetClientBoundsUntyped(nsIntRect &aRect) override;
+  NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &aRect) override;
+  NS_IMETHOD              GetRestoredBoundsUntyped(nsIntRect &aRect) override;
   NS_IMETHOD              GetNonClientMargins(nsIntMargin &margins) override;
   NS_IMETHOD              SetNonClientMargins(nsIntMargin &margins) override;
   virtual nsIntPoint      GetClientOffset() override;
   NS_IMETHOD              EnableDragDrop(bool aEnable) override;
   NS_IMETHOD              GetAttention(int32_t aCycleCount) override;
   virtual bool            HasPendingInputEvent() override;
   NS_IMETHOD              SetIcon(const nsAString &anIconSpec) override;
   NS_IMETHOD              SetWindowTitlebarColor(nscolor aColor, bool aActive) override;
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -797,54 +797,90 @@ class nsIWidget : public nsISupports {
      */
     NS_IMETHOD SetFocus(bool aRaise = false) = 0;
 
     /**
      * Get this widget's outside dimensions relative to its parent widget. For
      * popup widgets the returned rect is in screen coordinates and not
      * 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(nsIntRect &aRect) = 0;
+    NS_IMETHOD GetBounds(mozilla::LayoutDeviceIntRect &aRect) {
+      nsIntRect tmp;
+      nsresult rv = GetBoundsUntyped(tmp);
+      aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
+      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(nsIntRect &aRect) = 0;
+    NS_IMETHOD GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) {
+      nsIntRect tmp;
+      nsresult rv = GetScreenBoundsUntyped(tmp);
+      aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
+      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
      * nsSizeMode_Normal.
      *
+     * 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 GetRestoredBounds(nsIntRect &aRect) = 0;
+    NS_IMETHOD GetRestoredBounds(mozilla::LayoutDeviceIntRect &aRect) {
+      nsIntRect tmp;
+      nsresult rv = GetRestoredBoundsUntyped(tmp);
+      aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
+      return rv;
+    }
+    NS_IMETHOD GetRestoredBoundsUntyped(nsIntRect &aRect) = 0;
 
     /**
      * Get this widget's client area bounds, if the window has a 3D border
      * appearance this returns the area inside the border. The position is the
      * position of the client area relative to the client area of the parent
      * 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(nsIntRect &aRect) = 0;
+    NS_IMETHOD GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) {
+      nsIntRect tmp;
+      nsresult rv = GetClientBoundsUntyped(tmp);
+      aRect = mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
+      return rv;
+    }
+    NS_IMETHOD GetClientBoundsUntyped(nsIntRect &aRect) = 0;
 
     /**
      * Get the non-client area dimensions of the window.
      * 
      */
     NS_IMETHOD GetNonClientMargins(nsIntMargin &margins) = 0;
 
     /**
@@ -871,17 +907,17 @@ class nsIWidget : public nsISupports {
 
 
     /**
      * Equivalent to GetClientBounds but only returns the size.
      */
     virtual mozilla::gfx::IntSize GetClientSize() {
       // Dependeing on the backend, overloading this method may be useful if
       // if requesting the client offset is expensive.
-      nsIntRect rect;
+      mozilla::LayoutDeviceIntRect rect;
       GetClientBounds(rect);
       return mozilla::gfx::IntSize(rect.width, rect.height);
     }
 
     /**
      * Set the background color for this widget
      *
      * @param aColor the new background color
@@ -1912,37 +1948,44 @@ public:
      * a default background.
      */
     virtual bool WidgetPaintsBackground() { return false; }
 
     virtual bool NeedsPaint() {
        if (!IsVisible()) {
            return false;
        }
-       nsIntRect bounds;
+       mozilla::LayoutDeviceIntRect bounds;
        nsresult rv = GetBounds(bounds);
        NS_ENSURE_SUCCESS(rv, false);
        return !bounds.IsEmpty();
     }
 
     /**
      * Get the natural bounds of this widget.  This method is only
      * meaningful for widgets for which Gecko implements screen
      * rotation natively.  When this is the case, GetBounds() returns
      * the widget bounds taking rotation into account, and
      * GetNaturalBounds() returns the bounds *not* taking rotation
      * into account.
      *
      * No code outside of the composition pipeline should know or care
      * about this.  If you're not an agent of the compositor, you
      * probably shouldn't call this method.
+     *
+     * The untyped version exists temporarily to ease conversion to typed
+     * coordinates.
      */
-    virtual nsIntRect GetNaturalBounds() {
+    virtual mozilla::LayoutDeviceIntRect GetNaturalBounds() {
+        nsIntRect tmp = GetNaturalBoundsUntyped();
+        return mozilla::LayoutDeviceIntRect::FromUnknownRect(tmp);
+    }
+    virtual nsIntRect GetNaturalBoundsUntyped() {
         nsIntRect bounds;
-        GetBounds(bounds);
+        GetBoundsUntyped(bounds);
         return bounds;
     }
 
     /**
      * Set size constraints on the window size such that it is never less than
      * the specified minimum size and never larger than the specified maximum
      * size. The size constraints are sizes of the outer rectangle including
      * the window frame and title bar. Use 0 for an unconstrained minimum size
--- a/widget/nsNativeTheme.cpp
+++ b/widget/nsNativeTheme.cpp
@@ -589,17 +589,17 @@ nsNativeTheme::IsSubmenu(nsIFrame* aFram
   nsIContent* parentContent = aFrame->GetContent()->GetParent();
   if (!parentContent || !parentContent->IsXULElement(nsGkAtoms::menu))
     return false;
 
   nsIFrame* parent = aFrame;
   while ((parent = parent->GetParent())) {
     if (parent->GetContent() == parentContent) {
       if (aLeftOfParent) {
-        nsIntRect selfBounds, parentBounds;
+        LayoutDeviceIntRect selfBounds, parentBounds;
         aFrame->GetNearestWidget()->GetScreenBounds(selfBounds);
         parent->GetNearestWidget()->GetScreenBounds(parentBounds);
         *aLeftOfParent = selfBounds.x < parentBounds.x;
       }
       return true;
     }
   }
 
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -903,17 +903,17 @@ nsWindow::moveEvent(QMoveEvent* aEvent)
 }
 
 nsEventStatus
 nsWindow::resizeEvent(QResizeEvent* aEvent)
 {
     nsIntRect rect;
 
     // Generate XPFE resize event
-    GetBounds(rect);
+    GetBoundsUntyped(rect);
 
     rect.width = aEvent->size().width();
     rect.height = aEvent->size().height();
 
     mBounds.width = rect.width;
     mBounds.height = rect.height;
 
     nsEventStatus status;
@@ -1490,17 +1490,17 @@ void find_first_visible_parent(QWindow* 
                 aItem->setVisible(true);
                 aVisibleItem = aItem;
             }
         }
     }
 }
 
 NS_IMETHODIMP
-nsWindow::GetScreenBounds(nsIntRect &aRect)
+nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
 {
     aRect = gfx::IntRect(gfx::IntPoint(0, 0), mBounds.Size());
     if (mIsTopLevel) {
         QPoint pos = mWidget->position();
         aRect.MoveTo(pos.x(), pos.y());
     }
     else {
         aRect.MoveTo(WidgetToScreenOffsetUntyped());
--- a/widget/qt/nsWindow.h
+++ b/widget/qt/nsWindow.h
@@ -197,17 +197,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         GetScreenBounds(nsIntRect &aRect);
+    NS_IMETHOD         GetScreenBoundsUntyped(nsIntRect &aRect);
     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              GetScreenBounds(nsIntRect &aRect) override;
+    NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &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
@@ -274,17 +274,17 @@ private:
     js::ProfileEntry::Category::GRAPHICS);
 
   if (!mGeckoChild->IsVisible())
     return;
 
   mWaitingForPaint = NO;
 
   nsIntRect geckoBounds;
-  mGeckoChild->GetBounds(geckoBounds);
+  mGeckoChild->GetBoundsUntyped(geckoBounds);
   nsIntRegion region(geckoBounds);
 
   mGeckoChild->PaintWindow(region);
 }
 
 // Called asynchronously after setNeedsDisplay in order to avoid entering the
 // normal drawing machinery.
 - (void)drawUsingOpenGLCallback
@@ -300,17 +300,17 @@ private:
 {
     CGContextRef cgContext = UIGraphicsGetCurrentContext();
     [self drawRect:aRect inContext:cgContext];
 }
 
 - (void)drawRect:(CGRect)aRect inContext:(CGContextRef)aContext
 {
 #ifdef DEBUG_UPDATE
-  nsIntRect geckoBounds;
+  LayoutDeviceIntRect geckoBounds;
   mGeckoChild->GetBounds(geckoBounds);
 
   fprintf (stderr, "---- Update[%p][%p] [%f %f %f %f] cgc: %p\n  gecko bounds: [%d %d %d %d]\n",
            self, mGeckoChild,
            aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height, aContext,
            geckoBounds.x, geckoBounds.y, geckoBounds.width, geckoBounds.height);
 
   CGAffineTransform xform = CGContextGetCTM(aContext);
@@ -767,24 +767,24 @@ void nsWindow::ReportSizeModeEvent(nsSiz
         }
         mWidgetListener->SizeModeChanged(theMode);
     }
 }
 
 void nsWindow::ReportSizeEvent()
 {
     if (mWidgetListener) {
-        nsIntRect innerBounds;
+        LayoutDeviceIntRect innerBounds;
         GetClientBounds(innerBounds);
         mWidgetListener->WindowResized(this, innerBounds.width, innerBounds.height);
     }
 }
 
 NS_IMETHODIMP
-nsWindow::GetScreenBounds(nsIntRect &aRect)
+nsWindow::GetScreenBoundsUntyped(nsIntRect &aRect)
 {
     LayoutDeviceIntPoint p = WidgetToScreenOffset();
 
     aRect.x = p.x;
     aRect.y = p.y;
     aRect.width = mBounds.width;
     aRect.height = mBounds.height;
 
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -2386,17 +2386,17 @@ IMMHandler::SetIMERelatedWindowsPosOnPlu
     return;
   }
 
   // Clip the plugin rect by the client rect of the window because composition
   // window needs to be specified the position in the client area.
   nsWindow* toplevelWindow = aWindow->GetTopLevelWindow(false);
   LayoutDeviceIntRect pluginRectInScreen =
     editorRectEvent.mReply.mRect + toplevelWindow->WidgetToScreenOffset();
-  nsIntRect winRectInScreen;
+  LayoutDeviceIntRect winRectInScreen;
   aWindow->GetClientBounds(winRectInScreen);
   // composition window cannot be positioned on the edge of client area.
   winRectInScreen.width--;
   winRectInScreen.height--;
   nsIntRect clippedPluginRect;
   clippedPluginRect.x =
     std::min(std::max(pluginRectInScreen.x, winRectInScreen.x),
              winRectInScreen.XMost());
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -3746,30 +3746,30 @@ TSFTextStore::GetScreenExtInternal(RECT&
   refWindow = refWindow->GetTopLevelWindow(false);
   if (!refWindow) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::GetScreenExtInternal() FAILED due to "
             "no top level window", this));
     return false;
   }
 
-  nsIntRect boundRect;
+  LayoutDeviceIntRect boundRect;
   if (NS_FAILED(refWindow->GetClientBounds(boundRect))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::GetScreenExtInternal() FAILED due to "
             "failed to get the client bounds", this));
     return false;
   }
 
   boundRect.MoveTo(0, 0);
 
   // Clip frame rect to window rect
-  boundRect.IntersectRect(LayoutDevicePixel::ToUntyped(event.mReply.mRect), boundRect);
+  boundRect.IntersectRect(event.mReply.mRect, boundRect);
   if (!boundRect.IsEmpty()) {
-    boundRect.MoveBy(refWindow->WidgetToScreenOffsetUntyped());
+    boundRect.MoveBy(refWindow->WidgetToScreenOffset());
     ::SetRect(&aScreenExt, boundRect.x, boundRect.y,
               boundRect.XMost(), boundRect.YMost());
   } else {
     ::SetRectEmpty(&aScreenExt);
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
          ("TSF: 0x%p   TSFTextStore::GetScreenExtInternal() succeeded: "
--- 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::GetBounds(nsIntRect &aRect)
+NS_METHOD nsWindow::GetBoundsUntyped(nsIntRect &aRect)
 {
   if (mWnd) {
     RECT r;
     VERIFY(::GetWindowRect(mWnd, &r));
 
     // assign size
     aRect.width  = r.right - r.left;
     aRect.height = r.bottom - r.top;
@@ -1927,55 +1927,55 @@ NS_METHOD nsWindow::GetBounds(nsIntRect 
     aRect.y = r.top;
   } else {
     aRect = mBounds;
   }
   return NS_OK;
 }
 
 // Get this component dimension
-NS_METHOD nsWindow::GetClientBounds(nsIntRect &aRect)
+NS_METHOD nsWindow::GetClientBoundsUntyped(nsIntRect &aRect)
 {
   if (mWnd) {
     RECT r;
     VERIFY(::GetClientRect(mWnd, &r));
 
     nsIntRect bounds;
-    GetBounds(bounds);
+    GetBoundsUntyped(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::GetScreenBounds(nsIntRect &aRect)
+NS_METHOD nsWindow::GetScreenBoundsUntyped(nsIntRect &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;
 
   return NS_OK;
 }
 
-NS_METHOD nsWindow::GetRestoredBounds(nsIntRect &aRect)
+NS_METHOD nsWindow::GetRestoredBoundsUntyped(nsIntRect &aRect)
 {
   if (SizeMode() == nsSizeMode_Normal) {
-    return GetScreenBounds(aRect);
+    return GetScreenBoundsUntyped(aRect);
   }
   if (!mWnd) {
     return NS_ERROR_FAILURE;
   }
 
   WINDOWPLACEMENT pl = { sizeof(WINDOWPLACEMENT) };
   VERIFY(::GetWindowPlacement(mWnd, &pl));
   const RECT& r = pl.rcNormalPosition;
@@ -2662,22 +2662,22 @@ void nsWindow::UpdateOpaqueRegion(const 
   // all values must be set to -1 to get a full sheet of glass.
   MARGINS margins = { -1, -1, -1, -1 };
   if (!aOpaqueRegion.IsEmpty()) {
     nsIntRect pluginBounds;
     for (nsIWidget* child = GetFirstChild(); child; child = child->GetNextSibling()) {
       if (child->IsPlugin()) {
         // Collect the bounds of all plugins for GetLargestRectangle.
         nsIntRect childBounds;
-        child->GetBounds(childBounds);
+        child->GetBoundsUntyped(childBounds);
         pluginBounds.UnionRect(pluginBounds, childBounds);
       }
     }
 
-    nsIntRect clientBounds;
+    LayoutDeviceIntRect clientBounds;
     GetClientBounds(clientBounds);
 
     // Find the largest rectangle and use that to calculate the inset. Our top
     // priority is to include the bounds of all plugins.
     nsIntRect largest = aOpaqueRegion.GetLargestRectangle(pluginBounds);
     margins.cxLeftWidth = largest.x;
     margins.cxRightWidth = clientBounds.width - largest.XMost();
     margins.cyBottomHeight = clientBounds.height - largest.YMost();
@@ -3567,17 +3567,17 @@ nsWindow::OnDefaultButtonLoaded(const ns
   if (!isAlwaysSnapCursor) {
     BOOL snapDefaultButton;
     if (!::SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0,
                                 &snapDefaultButton, 0) || !snapDefaultButton)
       return NS_OK;
   }
 
   nsIntRect widgetRect;
-  nsresult rv = GetScreenBounds(widgetRect);
+  nsresult rv = GetScreenBoundsUntyped(widgetRect);
   NS_ENSURE_SUCCESS(rv, rv);
   nsIntRect buttonRect(aButtonRect + widgetRect.TopLeft());
 
   nsIntPoint centerOfButton(buttonRect.x + buttonRect.width / 2,
                             buttonRect.y + buttonRect.height / 2);
   // The center of the button can be outside of the widget.
   // E.g., it could be hidden by scrolling.
   if (!widgetRect.Contains(centerOfButton)) {
@@ -4200,22 +4200,22 @@ nsWindow::DispatchMouseEvent(EventMessag
   // call the event callback
   if (mWidgetListener) {
     if (nsToolkit::gMouseTrailer)
       nsToolkit::gMouseTrailer->Disable();
     if (aEventMessage == eMouseMove) {
       if (nsToolkit::gMouseTrailer && !sIsInMouseCapture) {
         nsToolkit::gMouseTrailer->SetMouseTrailerWindow(mWnd);
       }
-      nsIntRect rect;
+      LayoutDeviceIntRect rect;
       GetBounds(rect);
       rect.x = 0;
       rect.y = 0;
 
-      if (rect.Contains(LayoutDeviceIntPoint::ToUntyped(event.refPoint))) {
+      if (rect.Contains(event.refPoint)) {
         if (sCurrentWindow == nullptr || sCurrentWindow != this) {
           if ((nullptr != sCurrentWindow) && (!sCurrentWindow->mInDtor)) {
             LPARAM pos = sCurrentWindow->lParamToClient(lParamToScreen(lParam));
             sCurrentWindow->DispatchMouseEvent(eMouseExitFromWidget,
                                                wParam, pos, false, 
                                                WidgetMouseEvent::eLeftButton,
                                                aInputSource);
           }
@@ -6526,17 +6526,17 @@ nsWindow::ConfigureChildren(const nsTArr
   for (uint32_t i = 0; i < aConfigurations.Length(); ++i) {
     const Configuration& configuration = aConfigurations[i];
     nsWindow* w = static_cast<nsWindow*>(configuration.mChild.get());
     NS_ASSERTION(w->GetParent() == this,
                  "Configured widget is not a child");
     nsresult rv = w->SetWindowClipRegion(configuration.mClipRegion, true);
     NS_ENSURE_SUCCESS(rv, rv);
     nsIntRect bounds;
-    w->GetBounds(bounds);
+    w->GetBoundsUntyped(bounds);
     if (bounds.Size() != configuration.mBounds.Size()) {
       w->Resize(configuration.mBounds.x, configuration.mBounds.y,
                 configuration.mBounds.width, configuration.mBounds.height,
                 true);
     } else if (bounds.TopLeft() != configuration.mBounds.TopLeft()) {
       w->Move(configuration.mBounds.x, configuration.mBounds.y);
 
 
--- 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              GetBounds(nsIntRect &aRect);
-  NS_IMETHOD              GetScreenBounds(nsIntRect &aRect);
-  NS_IMETHOD              GetRestoredBounds(nsIntRect &aRect) override;
-  NS_IMETHOD              GetClientBounds(nsIntRect &aRect);
+  NS_IMETHOD              GetBoundsUntyped(nsIntRect &aRect);
+  NS_IMETHOD              GetScreenBoundsUntyped(nsIntRect &aRect);
+  NS_IMETHOD              GetRestoredBoundsUntyped(nsIntRect &aRect) override;
+  NS_IMETHOD              GetClientBoundsUntyped(nsIntRect &aRect);
   virtual nsIntPoint      GetClientOffset();
   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,
--- a/xpfe/appshell/nsWebShellWindow.cpp
+++ b/xpfe/appshell/nsWebShellWindow.cpp
@@ -170,17 +170,17 @@ nsresult nsWebShellWindow::Initialize(ns
     mParentWindow = do_GetWeakReference(aParent);
   }
 
   mWindow->SetWidgetListener(this);
   mWindow->Create((nsIWidget *)parentWidget,          // Parent nsIWidget
                   nullptr,                            // Native parent widget
                   r,                                  // Widget dimensions
                   &widgetInitData);                   // Widget initialization data
-  mWindow->GetClientBounds(r);
+  mWindow->GetClientBoundsUntyped(r);
   // Match the default background color of content. Important on windows
   // since we no longer use content child widgets.
   mWindow->SetBackgroundColor(NS_RGB(255,255,255));
 
   // Create web shell
   mDocShell = do_CreateInstance("@mozilla.org/docshell;1");
   NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
 
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -646,17 +646,17 @@ NS_IMETHODIMP nsXULWindow::SetPositionAn
   PersistentAttributesDirty(PAD_POSITION | PAD_SIZE);
   SavePersistentAttributes();
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULWindow::GetPositionAndSize(int32_t* x, int32_t* y, int32_t* cx,
    int32_t* cy)
 {
-  nsIntRect rect;
+  LayoutDeviceIntRect rect;
 
   if (!mWindow)
     return NS_ERROR_FAILURE;
 
   mWindow->GetScreenBounds(rect);
 
   if (x)
     *x = rect.x;
@@ -1482,17 +1482,17 @@ NS_IMETHODIMP nsXULWindow::SavePersisten
   }
 
   bool isFullscreen = false;
   if (nsPIDOMWindow* domWindow = mDocShell->GetWindow()) {
     isFullscreen = domWindow->GetFullScreen();
   }
 
   // get our size, position and mode to persist
-  nsIntRect rect;
+  LayoutDeviceIntRect rect;
   bool gotRestoredBounds = NS_SUCCEEDED(mWindow->GetRestoredBounds(rect));
 
   CSSToLayoutDeviceScale scale = mWindow->GetDefaultScale();
 
   // make our position relative to our parent, if any
   nsCOMPtr<nsIBaseWindow> parent(do_QueryReferent(mParentWindow));
   if (parent && gotRestoredBounds) {
     int32_t parentX, parentY;