Backed out 2 changesets (bug 1225007) for frequent OS X "Shouldn't return empty rect" assertion failures, a=backout
authorPhil Ringnalda <philringnalda@gmail.com>
Thu, 19 Nov 2015 20:55:26 -0800
changeset 273438 3835b568092ae3b71adc931d24928670ad7141a7
parent 273387 cc325db44f6f8a58604d60b746c140e73f3d8216
child 273439 ca10d0f073cab0142b5566776535f8fa030d6486
child 273517 1b2e15608f34fef0f23369731c80138f55f00cf2
child 273590 eb83bfa5f73945d1f28d6ba6da8080d6e1b5f26f
push id68281
push userphilringnalda@gmail.com
push dateFri, 20 Nov 2015 05:08:42 +0000
treeherdermozilla-inbound@ca10d0f073ca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1225007
milestone45.0a1
backs outc5b352c74b3594e984f04b472b70e78f56c2fd9c
8a513c70ce7c8542a9ba74bb903fbcd022d9aa14
first release with
nightly linux32
3835b568092a / 45.0a1 / 20151120030227 / files
nightly linux64
3835b568092a / 45.0a1 / 20151120030227 / files
nightly mac
3835b568092a / 45.0a1 / 20151120030227 / files
nightly win32
3835b568092a / 45.0a1 / 20151120030227 / files
nightly win64
3835b568092a / 45.0a1 / 20151120030227 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1225007) for frequent OS X "Shouldn't return empty rect" assertion failures, a=backout Backed out changeset c5b352c74b35 (bug 1225007) Backed out changeset 8a513c70ce7c (bug 1225007)
accessible/mac/mozAccessible.mm
gfx/layers/composite/LayerManagerComposite.cpp
layout/generic/nsGfxScrollFrame.cpp
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/cocoa/TextInputHandler.mm
widget/cocoa/VibrancyManager.mm
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaUtils.h
widget/cocoa/nsCocoaUtils.mm
widget/cocoa/nsCocoaWindow.mm
widget/cocoa/nsScreenCocoa.mm
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
widget/nsIWidget.h
--- a/accessible/mac/mozAccessible.mm
+++ b/accessible/mac/mozAccessible.mm
@@ -547,17 +547,17 @@ ConvertToNSArray(nsTArray<ProxyAccessibl
     return nil;
 
   // Convert the given screen-global point in the cocoa coordinate system (with
   // origin in the bottom-left corner of the screen) into point in the Gecko
   // coordinate system (with origin in a top-left screen point).
   NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
   NSPoint tmpPoint = NSMakePoint(point.x,
                                  [mainView frame].size.height - point.y);
-  LayoutDeviceIntPoint geckoPoint = nsCocoaUtils::
+  nsIntPoint geckoPoint = nsCocoaUtils::
     CocoaPointsToDevPixels(tmpPoint, nsCocoaUtils::GetBackingScaleFactor(mainView));
 
   mozAccessible* nativeChild = nil;
   if (accWrap) {
     Accessible* child = accWrap->ChildAtPoint(geckoPoint.x, geckoPoint.y,
                                   Accessible::eDeepestChild);
     if (child)
       nativeChild = GetNativeFromGeckoAccessible(child);
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -805,19 +805,20 @@ LayerManagerComposite::Render(const nsIn
 
   if (mTwoPassTmpTarget) {
     MOZ_ASSERT(haveLayerEffects);
     PopGroupForLayerEffects(previousTarget, clipRect.ToUnknownRect(),
                             grayscaleVal, invertVal, contrastVal);
   }
 
   // Allow widget to render a custom foreground.
-  mCompositor->GetWidget()->DrawWindowOverlay(
-    this, LayoutDeviceIntRect(actualBounds.x, actualBounds.y,
-                              actualBounds.width, actualBounds.height));
+  mCompositor->GetWidget()->DrawWindowOverlay(this, IntRect(actualBounds.x,
+                                                              actualBounds.y,
+                                                              actualBounds.width,
+                                                              actualBounds.height));
 
   // Debugging
   RenderDebugOverlay(actualBounds);
 
   {
     PROFILER_LABEL("LayerManagerComposite", "EndFrame",
       js::ProfileEntry::Category::GRAPHICS);
 
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -4949,17 +4949,17 @@ ScrollFrameHelper::AdjustScrollbarRectFo
   // widget has a resizer.
   nsRect resizerRect;
   if (aHasResizer) {
     resizerRect = mResizerBox->GetRect();
   }
   else {
     nsPoint offset;
     nsIWidget* widget = aFrame->GetNearestWidget(offset);
-    LayoutDeviceIntRect widgetRect;
+    nsIntRect widgetRect;
     if (!widget || !widget->ShowsResizeIndicator(&widgetRect))
       return;
 
     resizerRect = nsRect(aPresContext->DevPixelsToAppUnits(widgetRect.x) - offset.x,
                          aPresContext->DevPixelsToAppUnits(widgetRect.y) - offset.y,
                          aPresContext->DevPixelsToAppUnits(widgetRect.width),
                          aPresContext->DevPixelsToAppUnits(widgetRect.height));
   }
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2631,18 +2631,17 @@ nsWindow::DrawWindowUnderlay(LayerManage
     client->ActivateProgram();
     if (!mLayerRendererFrame.BeginDrawing(&jniFrame)) return;
     if (!mLayerRendererFrame.DrawBackground(&jniFrame)) return;
     client->DeactivateProgramAndRestoreState(scissorEnabled,
         scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);
 }
 
 void
-nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager,
-                            LayoutDeviceIntRect aRect)
+nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
 {
     PROFILER_LABEL("nsWindow", "DrawWindowOverlay",
         js::ProfileEntry::Category::GRAPHICS);
 
     if (mLayerRendererFrame.isNull()) {
         NS_WARNING("Warning: do not have a LayerRenderer frame; aborting window overlay draw");
         return;
     }
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -147,17 +147,17 @@ public:
                                    LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
                                    LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
                                    bool* aAllowRetaining = nullptr) override;
 
     NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) override;
 
     virtual bool NeedsPaint() override;
     virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) override;
-    virtual void DrawWindowOverlay(LayerManagerComposite* aManager, LayoutDeviceIntRect aRect) override;
+    virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) override;
 
     virtual mozilla::layers::CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) override;
 
     static void SetCompositor(mozilla::layers::LayerManager* aLayerManager,
                               mozilla::layers::CompositorParent* aCompositorParent,
                               mozilla::layers::CompositorChild* aCompositorChild);
     static bool IsCompositionPaused();
     static void InvalidateAndScheduleComposite();
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -3311,17 +3311,18 @@ IMEInputHandler::FirstRectForCharacterRa
   nsIWidget* rootWidget = mWidget->GetTopLevelWidget();
   NSWindow* rootWindow =
     static_cast<NSWindow*>(rootWidget->GetNativeData(NS_NATIVE_WINDOW));
   NSView* rootView =
     static_cast<NSView*>(rootWidget->GetNativeData(NS_NATIVE_WIDGET));
   if (!rootWindow || !rootView) {
     return rect;
   }
-  rect = nsCocoaUtils::DevPixelsToCocoaPoints(r, mWidget->BackingScaleFactor());
+  rect = nsCocoaUtils::DevPixelsToCocoaPoints(r.ToUnknownRect(),
+                                              mWidget->BackingScaleFactor());
   rect = [rootView convertRect:rect toView:nil];
   rect.origin = [rootWindow convertBaseToScreen:rect.origin];
 
   if (aActualRange) {
     *aActualRange = actualRange;
   }
 
   MOZ_LOG(gLog, LogLevel::Info,
--- a/widget/cocoa/VibrancyManager.mm
+++ b/widget/cocoa/VibrancyManager.mm
@@ -27,17 +27,17 @@ VibrancyManager::UpdateVibrantRegion(Vib
   vr.effectViews.SwapElements(viewsToRecycle);
   // vr.effectViews is now empty.
 
   nsIntRegionRectIterator iter(aRegion);
   const nsIntRect* iterRect = nullptr;
   for (size_t i = 0; (iterRect = iter.Next()) || i < viewsToRecycle.Length(); ++i) {
     if (iterRect) {
       NSView* view = nil;
-      NSRect rect = mCoordinateConverter.UntypedDevPixelsToCocoaPoints(*iterRect);
+      NSRect rect = mCoordinateConverter.DevPixelsToCocoaPoints(*iterRect);
       if (i < viewsToRecycle.Length()) {
         view = viewsToRecycle[i];
         [view setFrame:rect];
         [view setNeedsDisplay:YES];
       } else {
         view = CreateEffectView(aType, rect);
         [mContainerView addSubview:view];
 
@@ -67,17 +67,17 @@ VibrancyManager::ClearVibrantAreas() con
 
 void
 VibrancyManager::ClearVibrantRegion(const VibrantRegion& aVibrantRegion) const
 {
   [[NSColor clearColor] set];
 
   nsIntRegionRectIterator iter(aVibrantRegion.region);
   while (const nsIntRect* rect = iter.Next()) {
-    NSRectFill(mCoordinateConverter.UntypedDevPixelsToCocoaPoints(*rect));
+    NSRectFill(mCoordinateConverter.DevPixelsToCocoaPoints(*rect));
   }
 }
 
 @interface NSView(CurrentFillColor)
 - (NSColor*)_currentFillColor;
 @end
 
 static NSColor*
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -398,17 +398,17 @@ public:
 
   virtual int32_t         RoundsWidgetCoordinatesTo() override;
 
   NS_IMETHOD              Invalidate(const nsIntRect &aRect) override;
 
   virtual void*           GetNativeData(uint32_t aDataType) override;
   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
   virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
-  virtual bool            ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
+  virtual bool            ShowsResizeIndicator(nsIntRect* aResizerRect) override;
 
   static  bool            ConvertStatus(nsEventStatus aStatus)
                           { return aStatus == nsEventStatus_eConsumeNoDefault; }
   NS_IMETHOD              DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                                         nsEventStatus& aStatus) override;
 
   virtual bool            ComputeShouldAccelerate() override;
   virtual bool            ShouldUseOffMainThreadCompositing() override;
@@ -482,23 +482,22 @@ public:
   already_AddRefed<mozilla::a11y::Accessible> GetDocumentAccessible();
 #endif
 
   virtual void CreateCompositor() override;
   virtual void PrepareWindowEffects() override;
   virtual void CleanupWindowEffects() override;
   virtual bool PreRender(LayerManagerComposite* aManager) override;
   virtual void PostRender(LayerManagerComposite* aManager) override;
-  virtual void DrawWindowOverlay(LayerManagerComposite* aManager,
-                                 LayoutDeviceIntRect aRect) override;
+  virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) override;
 
   virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
 
   virtual void UpdateWindowDraggingRegion(const nsIntRegion& aRegion) override;
-  const LayoutDeviceIntRegion& GetDraggableRegion() { return mDraggableRegion; }
+  const nsIntRegion& GetDraggableRegion() { return mDraggableRegion; }
 
   virtual void ReportSwipeStarted(uint64_t aInputBlockId, bool aStartSwipe) override;
 
   void              ResetParent();
 
   static bool DoHasPendingInputEvent();
   static uint32_t GetCurrentInputEventCount();
   static void UpdateCurrentInputEventCount();
@@ -517,31 +516,26 @@ public:
   void              ClearVibrantAreas();
   NSColor*          VibrancyFillColorForThemeGeometryType(nsITheme::ThemeGeometryType aThemeGeometryType);
   NSColor*          VibrancyFontSmoothingBackgroundColorForThemeGeometryType(nsITheme::ThemeGeometryType aThemeGeometryType);
 
   // unit conversion convenience functions
   int32_t           CocoaPointsToDevPixels(CGFloat aPts) const {
     return nsCocoaUtils::CocoaPointsToDevPixels(aPts, BackingScaleFactor());
   }
-  LayoutDeviceIntPoint CocoaPointsToDevPixels(const NSPoint& aPt) const {
+  nsIntPoint        CocoaPointsToDevPixels(const NSPoint& aPt) const {
     return nsCocoaUtils::CocoaPointsToDevPixels(aPt, BackingScaleFactor());
   }
-  LayoutDeviceIntRect CocoaPointsToDevPixels(const NSRect& aRect) const {
+  nsIntRect         CocoaPointsToDevPixels(const NSRect& aRect) const {
     return nsCocoaUtils::CocoaPointsToDevPixels(aRect, BackingScaleFactor());
   }
   CGFloat           DevPixelsToCocoaPoints(int32_t aPixels) const {
     return nsCocoaUtils::DevPixelsToCocoaPoints(aPixels, BackingScaleFactor());
   }
-  // XXX: all calls to this function should eventually be replaced with calls
-  // to DevPixelsToCocoaPoints().
-  NSRect            UntypedDevPixelsToCocoaPoints(const nsIntRect& aRect) const {
-    return nsCocoaUtils::UntypedDevPixelsToCocoaPoints(aRect, BackingScaleFactor());
-  }
-  NSRect            DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect) const {
+  NSRect            DevPixelsToCocoaPoints(const nsIntRect& aRect) const {
     return nsCocoaUtils::DevPixelsToCocoaPoints(aRect, BackingScaleFactor());
   }
 
   already_AddRefed<mozilla::gfx::DrawTarget> StartRemoteDrawing() override;
   void EndRemoteDrawing() override;
   void CleanupRemoteDrawing() override;
   bool InitCompositor(mozilla::layers::Compositor* aCompositor) override;
 
@@ -578,29 +572,29 @@ protected:
     static NS_DEFINE_IID(kCPopUpCID, NS_POPUP_CID);
     nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID);
     return widget.forget();
   }
 
   void ConfigureAPZCTreeManager() override;
   void ConfigureAPZControllerThread() override;
 
-  void DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect);
+  void DoRemoteComposition(const nsIntRect& aRenderRect);
 
   // Overlay drawing functions for OpenGL drawing
-  void DrawWindowOverlay(mozilla::layers::GLManager* aManager, LayoutDeviceIntRect aRect);
-  void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager);
-  void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager, const LayoutDeviceIntRect& aRect);
-  void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager);
+  void DrawWindowOverlay(mozilla::layers::GLManager* aManager, nsIntRect aRect);
+  void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
+  void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
+  void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
 
   // Redraw the contents of mTitlebarCGContext on the main thread, as
   // determined by mDirtyTitlebarRegion.
   void UpdateTitlebarCGContext();
 
-  LayoutDeviceIntRect RectContainingTitlebarControls();
+  nsIntRect RectContainingTitlebarControls();
   void UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries);
   mozilla::VibrancyManager& EnsureVibrancyManager();
 
   nsIWidget* GetWidgetForListenerEvents();
 
   virtual nsresult NotifyIMEInternal(
                      const IMENotification& aIMENotification) override;
 
@@ -632,39 +626,39 @@ protected:
   // progress on the compositor thread.
   mozilla::Mutex mViewTearDownLock;
 
   mozilla::Mutex mEffectsLock;
 
   // May be accessed from any thread, protected
   // by mEffectsLock.
   bool mShowsResizeIndicator;
-  LayoutDeviceIntRect mResizeIndicatorRect;
+  nsIntRect mResizeIndicatorRect;
   bool mHasRoundedBottomCorners;
   int mDevPixelCornerRadius;
   bool mIsCoveringTitlebar;
   bool mIsFullscreen;
-  LayoutDeviceIntRect mTitlebarRect;
+  nsIntRect mTitlebarRect;
 
   // The area of mTitlebarCGContext that needs to be redrawn during the next
   // transaction. Accessed from any thread, protected by mEffectsLock.
-  LayoutDeviceIntRegion mUpdatedTitlebarRegion;
+  nsIntRegion mUpdatedTitlebarRegion;
   CGContextRef mTitlebarCGContext;
 
   // Compositor thread only
   nsAutoPtr<RectTextureImage> mResizerImage;
   nsAutoPtr<RectTextureImage> mCornerMaskImage;
   nsAutoPtr<RectTextureImage> mTitlebarImage;
   nsAutoPtr<RectTextureImage> mBasicCompositorImage;
 
   // The area of mTitlebarCGContext that has changed and needs to be
   // uploaded to to mTitlebarImage. Main thread only.
   nsIntRegion           mDirtyTitlebarRegion;
 
-  LayoutDeviceIntRegion mDraggableRegion;
+  nsIntRegion           mDraggableRegion;
 
   // Cached value of [mView backingScaleFactor], to avoid sending two obj-c
   // messages (respondsToSelector, backingScaleFactor) every time we need to
   // use it.
   // ** We'll need to reinitialize this if the backing resolution changes. **
   mutable CGFloat       mBackingScaleFactor;
 
   bool                  mVisible;
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -88,18 +88,16 @@
 #include "nsIDOMWheelEvent.h"
 #include "mozilla/layers/ChromeProcessController.h"
 #include "nsLayoutUtils.h"
 #include "InputData.h"
 #include "SwipeTracker.h"
 #include "VibrancyManager.h"
 #include "nsNativeThemeCocoa.h"
 #include "nsIDOMWindowUtils.h"
-#include "Units.h"
-#include "UnitTransforms.h"
 
 using namespace mozilla;
 using namespace mozilla::layers;
 using namespace mozilla::gl;
 using namespace mozilla::widget;
 
 using mozilla::gfx::Matrix4x4;
 
@@ -159,17 +157,17 @@ static uint32_t gNumberOfWidgetsNeedingE
 
 - (NSMenu*)contextMenu;
 
 - (BOOL)isRectObscuredBySubview:(NSRect)inRect;
 
 - (void)processPendingRedraws;
 
 - (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
-- (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
+- (nsIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
 - (BOOL)isUsingMainThreadOpenGL;
 - (BOOL)isUsingOpenGL;
 - (void)drawUsingOpenGL;
 - (void)drawUsingOpenGLCallback;
 
 - (BOOL)hasRoundedBottomCorners;
 - (CGFloat)cornerRadius;
 - (void)clearCorners;
@@ -188,17 +186,17 @@ static uint32_t gNumberOfWidgetsNeedingE
  // a context menu (click-hold)
 - (void)clickHoldCallback:(id)inEvent;
 #endif
 
 #ifdef ACCESSIBILITY
 - (id<mozAccessible>)accessible;
 #endif
 
-- (LayoutDeviceIntPoint)convertWindowCoordinates:(NSPoint)aPoint;
+- (nsIntPoint)convertWindowCoordinates:(NSPoint)aPoint;
 - (APZCTreeManager*)apzctm;
 
 - (BOOL)inactiveWindowAcceptsMouseEvent:(NSEvent*)aEvent;
 - (void)updateWindowDraggableState;
 
 - (bool)shouldConsiderStartingSwipeFromEvent:(NSEvent*)aEvent;
 
 @end
@@ -276,57 +274,54 @@ public:
    : mGLContext(aGLContext)
    , mTexture(0)
    , mInUpdate(false)
   {}
 
   virtual ~RectTextureImage();
 
   already_AddRefed<gfx::DrawTarget>
-    BeginUpdate(const LayoutDeviceIntSize& aNewSize,
-                const LayoutDeviceIntRegion& aDirtyRegion =
-                  LayoutDeviceIntRegion());
+    BeginUpdate(const nsIntSize& aNewSize,
+                const nsIntRegion& aDirtyRegion = nsIntRegion());
   void EndUpdate(bool aKeepSurface = false);
 
-  void UpdateIfNeeded(const LayoutDeviceIntSize& aNewSize,
-                      const LayoutDeviceIntRegion& aDirtyRegion,
-                      void (^aCallback)(gfx::DrawTarget*,
-                                        const LayoutDeviceIntRegion&))
+  void UpdateIfNeeded(const nsIntSize& aNewSize,
+                      const nsIntRegion& aDirtyRegion,
+                      void (^aCallback)(gfx::DrawTarget*, const nsIntRegion&))
   {
     RefPtr<gfx::DrawTarget> drawTarget = BeginUpdate(aNewSize, aDirtyRegion);
     if (drawTarget) {
       aCallback(drawTarget, GetUpdateRegion());
       EndUpdate();
     }
   }
 
-  void UpdateFromCGContext(const LayoutDeviceIntSize& aNewSize,
-                           const LayoutDeviceIntRegion& aDirtyRegion,
+  void UpdateFromCGContext(const nsIntSize& aNewSize,
+                           const nsIntRegion& aDirtyRegion,
                            CGContextRef aCGContext);
 
-  LayoutDeviceIntRegion GetUpdateRegion() {
+  nsIntRegion GetUpdateRegion() {
     MOZ_ASSERT(mInUpdate, "update region only valid during update");
     return mUpdateRegion;
   }
 
   void Draw(mozilla::layers::GLManager* aManager,
-            const LayoutDeviceIntPoint& aLocation,
+            const nsIntPoint& aLocation,
             const Matrix4x4& aTransform = Matrix4x4());
 
-  static LayoutDeviceIntSize TextureSizeForSize(
-    const LayoutDeviceIntSize& aSize);
+  static nsIntSize TextureSizeForSize(const nsIntSize& aSize);
 
 protected:
 
   RefPtr<gfx::DrawTarget> mUpdateDrawTarget;
   GLContext* mGLContext;
-  LayoutDeviceIntRegion mUpdateRegion;
-  LayoutDeviceIntSize mUsedSize;
-  LayoutDeviceIntSize mBufferSize;
-  LayoutDeviceIntSize mTextureSize;
+  nsIntRegion mUpdateRegion;
+  nsIntSize mUsedSize;
+  nsIntSize mBufferSize;
+  nsIntSize mTextureSize;
   GLuint mTexture;
   bool mInUpdate;
 };
 
 // Used for OpenGL drawing from the compositor thread for OMTC BasicLayers.
 // We need to use OpenGL for this because there seems to be no other robust
 // way of drawing from a secondary thread without locking, which would cause
 // deadlocks in our setup. See bug 882523.
@@ -356,17 +351,17 @@ public:
   virtual void ActivateProgram(ShaderProgramOGL *aProg) override
   {
     mGLContext->fUseProgram(aProg->GetProgram());
   }
   virtual void BindAndDrawQuad(ShaderProgramOGL *aProg,
                                const gfx::Rect& aLayerRect,
                                const gfx::Rect& aTextureRect) override;
 
-  void BeginFrame(LayoutDeviceIntSize aRenderSize);
+  void BeginFrame(nsIntSize aRenderSize);
   void EndFrame();
 
   NSOpenGLContext* GetNSOpenGLContext()
   {
     return GLContextCGL::Cast(mGLContext)->GetNSOpenGLContext();
   }
 
 protected:
@@ -513,18 +508,17 @@ nsresult nsChildView::Create(nsIWidget *
     // aNativeParent will be the contentView of our window, since that's what
     // nsCocoaWindow returns when asked for an NS_NATIVE_VIEW.
     mParentView = reinterpret_cast<NSView<mozView>*>(aNativeParent);
   }
 
   // create our parallel NSView and hook it up to our parent. Recall
   // that NS_NATIVE_WIDGET is the NSView.
   CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mParentView);
-  NSRect r = nsCocoaUtils::DevPixelsToCocoaPoints(
-    LayoutDeviceIntRect::FromUnknownRect(mBounds), scaleFactor);
+  NSRect r = nsCocoaUtils::DevPixelsToCocoaPoints(mBounds, scaleFactor);
   mView = [(NSView<mozView>*)CreateCocoaView(r) retain];
   if (!mView) {
     return NS_ERROR_FAILURE;
   }
 
   // If this view was created in a Gecko view hierarchy, the initial state
   // is hidden.  If the view is attached only to a native NSView but has
   // no Gecko parent (as in embedding), the initial state is visible.
@@ -909,19 +903,23 @@ NS_IMETHODIMP nsChildView::SetCursor(img
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 #pragma mark -
 
 // Get this component dimension
 NS_IMETHODIMP nsChildView::GetBounds(LayoutDeviceIntRect& aRect)
 {
-  aRect = !mView
-        ? LayoutDeviceIntRect::FromUnknownRect(mBounds)
-        : CocoaPointsToDevPixels([mView frame]);
+  nsIntRect tmp;
+  if (!mView) {
+    tmp = mBounds;
+  } else {
+    tmp = CocoaPointsToDevPixels([mView frame]);
+  }
+  aRect = LayoutDeviceIntRect::FromUnknownRect(tmp);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsChildView::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect)
 {
   GetBounds(aRect);
   if (!mParentWidget) {
     // For top level widgets we want the position on screen, not the position
@@ -1003,17 +1001,17 @@ NS_IMETHODIMP nsChildView::Move(double a
 
   if (!mView || (mBounds.x == x && mBounds.y == y))
     return NS_OK;
 
   mBounds.x = x;
   mBounds.y = y;
 
   ManipulateViewWithoutNeedingDisplay(mView, ^{
-    [mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
+    [mView setFrame:DevPixelsToCocoaPoints(mBounds)];
   });
 
   NotifyRollupGeometryChange();
   ReportMoveEvent();
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
@@ -1028,17 +1026,17 @@ NS_IMETHODIMP nsChildView::Resize(double
 
   if (!mView || (mBounds.width == width && mBounds.height == height))
     return NS_OK;
 
   mBounds.width  = width;
   mBounds.height = height;
 
   ManipulateViewWithoutNeedingDisplay(mView, ^{
-    [mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
+    [mView setFrame:DevPixelsToCocoaPoints(mBounds)];
   });
 
   if (mVisible && aRepaint)
     [mView setNeedsDisplay:YES];
 
   NotifyRollupGeometryChange();
   ReportSizeEvent();
 
@@ -1067,17 +1065,17 @@ NS_IMETHODIMP nsChildView::Resize(double
     mBounds.y = y;
   }
   if (isResizing) {
     mBounds.width  = width;
     mBounds.height = height;
   }
 
   ManipulateViewWithoutNeedingDisplay(mView, ^{
-    [mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
+    [mView setFrame:DevPixelsToCocoaPoints(mBounds)];
   });
 
   if (mVisible && aRepaint)
     [mView setNeedsDisplay:YES];
 
   NotifyRollupGeometryChange();
   if (isMoving) {
     ReportMoveEvent();
@@ -1089,17 +1087,17 @@ NS_IMETHODIMP nsChildView::Resize(double
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 static const int32_t resizeIndicatorWidth = 15;
 static const int32_t resizeIndicatorHeight = 15;
-bool nsChildView::ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect)
+bool nsChildView::ShowsResizeIndicator(nsIntRect* aResizerRect)
 {
   NSView *topLevelView = mView, *superView = nil;
   while ((superView = [topLevelView superview]))
     topLevelView = superView;
 
   if (![[topLevelView window] showsResizeIndicator] ||
       !([[topLevelView window] styleMask] & NSResizableWindowMask))
     return false;
@@ -1361,20 +1359,20 @@ NS_IMETHODIMP nsChildView::Invalidate(co
     return NS_OK;
 
   NS_ASSERTION(GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_CLIENT,
                "Shouldn't need to invalidate with accelerated OMTC layers!");
 
   if ([NSView focusView]) {
     // if a view is focussed (i.e. being drawn), then postpone the invalidate so that we
     // don't lose it.
-    [mView setNeedsPendingDisplayInRect:UntypedDevPixelsToCocoaPoints(aRect)];
+    [mView setNeedsPendingDisplayInRect:DevPixelsToCocoaPoints(aRect)];
   }
   else {
-    [mView setNeedsDisplayInRect:UntypedDevPixelsToCocoaPoints(aRect)];
+    [mView setNeedsDisplayInRect:DevPixelsToCocoaPoints(aRect)];
   }
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 bool
@@ -1525,17 +1523,17 @@ void nsChildView::ReportSizeEvent()
 #pragma mark -
 
 LayoutDeviceIntPoint nsChildView::GetClientOffset()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   NSPoint origin = [mView convertPoint:NSMakePoint(0, 0) toView:nil];
   origin.y = [[mView window] frame].size.height - origin.y;
-  return CocoaPointsToDevPixels(origin);
+  return LayoutDeviceIntPoint::FromUnknownPoint(CocoaPointsToDevPixels(origin));
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
 }
 
 //    Return the offset between this child view and the screen.
 //    @return       -- widget origin in device-pixel coords
 LayoutDeviceIntPoint nsChildView::WidgetToScreenOffset()
 {
@@ -1550,17 +1548,17 @@ LayoutDeviceIntPoint nsChildView::Widget
   // 2. We turn the window-coord rect's origin into screen (still bottom-left) coords.
   origin = [[mView window] convertBaseToScreen:origin];
 
   // 3. Since we're dealing in bottom-left coords, we need to make it top-left coords
   //    before we pass it back to Gecko.
   FlipCocoaScreenCoordinate(origin);
 
   // convert to device pixels
-  return CocoaPointsToDevPixels(origin);
+  return LayoutDeviceIntPoint::FromUnknownPoint(CocoaPointsToDevPixels(origin));
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
 }
 
 NS_IMETHODIMP nsChildView::CaptureRollupEvents(nsIRollupListener * aListener,
                                                bool aDoCapture)
 {
   // this never gets called, only top-level windows can be rollup widgets
@@ -1938,17 +1936,17 @@ nsChildView::ConfigureAPZControllerThrea
     // The EventThreadRunner is the controller thread, but it doesn't
     // have a MessageLoop.
     APZThreadUtils::SetControllerThread(nullptr);
   } else {
     nsBaseWidget::ConfigureAPZControllerThread();
   }
 }
 
-LayoutDeviceIntRect
+nsIntRect
 nsChildView::RectContainingTitlebarControls()
 {
   // Start with a thin strip at the top of the window for the highlight line.
   NSRect rect = NSMakeRect(0, 0, [mView bounds].size.width,
                            [(ChildView*)mView cornerRadius]);
 
   // Add the rects of the titlebar controls.
   for (id view in [(BaseWindow*)[mView window] titlebarControls]) {
@@ -2012,40 +2010,39 @@ nsChildView::PostRender(LayerManagerComp
     return;
   }
   NSOpenGLContext *glContext = GLContextCGL::Cast(manager->gl())->GetNSOpenGLContext();
   [(ChildView*)mView postRender:glContext];
   mViewTearDownLock.Unlock();
 }
 
 void
-nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager,
-                               LayoutDeviceIntRect aRect)
+nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
 {
   nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
   if (manager) {
     DrawWindowOverlay(manager, aRect);
   }
 }
 
 void
-nsChildView::DrawWindowOverlay(GLManager* aManager, LayoutDeviceIntRect aRect)
+nsChildView::DrawWindowOverlay(GLManager* aManager, nsIntRect aRect)
 {
   GLContext* gl = aManager->gl();
   ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST, false);
 
-  MaybeDrawTitlebar(aManager);
-  MaybeDrawResizeIndicator(aManager);
+  MaybeDrawTitlebar(aManager, aRect);
+  MaybeDrawResizeIndicator(aManager, aRect);
   MaybeDrawRoundedCorners(aManager, aRect);
 }
 
 static void
-ClearRegion(gfx::DrawTarget *aDT, LayoutDeviceIntRegion aRegion)
-{
-  gfxUtils::ClipToRegion(aDT, aRegion.ToUnknownRegion());
+ClearRegion(gfx::DrawTarget *aDT, nsIntRegion aRegion)
+{
+  gfxUtils::ClipToRegion(aDT, aRegion);
   aDT->ClearRect(gfx::Rect(0, 0, aDT->GetSize().width, aDT->GetSize().height));
   aDT->PopClip();
 }
 
 static void
 DrawResizer(CGContextRef aCtx)
 {
   CGContextSetShouldAntialias(aCtx, false);
@@ -2074,29 +2071,29 @@ DrawResizer(CGContextRef aCtx)
   points[3] = CGPointMake(9.0f, 14.0f);
   points[5] = CGPointMake(13.0f, 13.9f);
   points[4] = CGPointMake(13.0f, 14.0f);
   CGContextSetRGBStrokeColor(aCtx, 0.84f, 0.84f, 0.84f, 0.55f);
   CGContextStrokeLineSegments(aCtx, points, 6);
 }
 
 void
-nsChildView::MaybeDrawResizeIndicator(GLManager* aManager)
+nsChildView::MaybeDrawResizeIndicator(GLManager* aManager, const nsIntRect& aRect)
 {
   MutexAutoLock lock(mEffectsLock);
   if (!mShowsResizeIndicator) {
     return;
   }
 
   if (!mResizerImage) {
     mResizerImage = new RectTextureImage(aManager->gl());
   }
 
-  LayoutDeviceIntSize size = mResizeIndicatorRect.Size();
-  mResizerImage->UpdateIfNeeded(size, LayoutDeviceIntRegion(), ^(gfx::DrawTarget* drawTarget, const LayoutDeviceIntRegion& updateRegion) {
+  nsIntSize size = mResizeIndicatorRect.Size();
+  mResizerImage->UpdateIfNeeded(size, nsIntRegion(), ^(gfx::DrawTarget* drawTarget, const nsIntRegion& updateRegion) {
     ClearRegion(drawTarget, updateRegion);
     gfx::BorrowedCGContext borrow(drawTarget);
     DrawResizer(borrow.cg);
     borrow.Finish();
   });
 
   mResizerImage->Draw(aManager, mResizeIndicatorRect.TopLeft());
 }
@@ -2129,17 +2126,17 @@ DrawTitlebarHighlight(NSSize aWindowSize
     [[NSColor colorWithDeviceWhite:1.0 alpha:0.4 * (1.0 - t)] set];
     NSRectFillUsingOperation(NSMakeRect(0, y, aWindowSize.width, aDevicePixelWidth), NSCompositeSourceOver);
   }
 
   [NSGraphicsContext restoreGraphicsState];
 }
 
 static CGContextRef
-CreateCGContext(const LayoutDeviceIntSize& aSize)
+CreateCGContext(const nsIntSize& aSize)
 {
   CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
   CGContextRef ctx =
     CGBitmapContextCreate(NULL,
                           aSize.width,
                           aSize.height,
                           8 /* bitsPerComponent */,
                           aSize.width * 4,
@@ -2162,18 +2159,17 @@ nsChildView::UpdateTitlebarCGContext()
     ReleaseTitlebarCGContext();
     return;
   }
 
   NSRect titlebarRect = DevPixelsToCocoaPoints(mTitlebarRect);
   NSRect dirtyRect = [mView convertRect:[(BaseWindow*)[mView window] getAndResetNativeDirtyRect] fromView:nil];
   NSRect dirtyTitlebarRect = NSIntersectionRect(titlebarRect, dirtyRect);
 
-  LayoutDeviceIntSize texSize =
-    RectTextureImage::TextureSizeForSize(mTitlebarRect.Size());
+  nsIntSize texSize = RectTextureImage::TextureSizeForSize(mTitlebarRect.Size());
   if (!mTitlebarCGContext ||
       CGBitmapContextGetWidth(mTitlebarCGContext) != size_t(texSize.width) ||
       CGBitmapContextGetHeight(mTitlebarCGContext) != size_t(texSize.height)) {
     dirtyTitlebarRect = titlebarRect;
 
     ReleaseTitlebarCGContext();
 
     mTitlebarCGContext = CreateCGContext(texSize);
@@ -2284,24 +2280,24 @@ nsChildView::UpdateTitlebarCGContext()
 // This is necessary because the real titlebar controls are covered by our
 // OpenGL context. Note that in terms of the NSView hierarchy, our ChildView
 // is actually below the titlebar controls - that's why hovering and clicking
 // them works as expected - but their visual representation is only drawn into
 // the normal window buffer, and the window buffer surface lies below the
 // GLContext surface. In order to make the titlebar controls visible, we have
 // to redraw them inside the OpenGL context surface.
 void
-nsChildView::MaybeDrawTitlebar(GLManager* aManager)
+nsChildView::MaybeDrawTitlebar(GLManager* aManager, const nsIntRect& aRect)
 {
   MutexAutoLock lock(mEffectsLock);
   if (!mIsCoveringTitlebar || mIsFullscreen) {
     return;
   }
 
-  LayoutDeviceIntRegion updatedTitlebarRegion;
+  nsIntRegion updatedTitlebarRegion;
   updatedTitlebarRegion.And(mUpdatedTitlebarRegion, mTitlebarRect);
   mUpdatedTitlebarRegion.SetEmpty();
 
   if (!mTitlebarImage) {
     mTitlebarImage = new RectTextureImage(aManager->gl());
   }
 
   mTitlebarImage->UpdateFromCGContext(mTitlebarRect.Size(),
@@ -2314,27 +2310,26 @@ nsChildView::MaybeDrawTitlebar(GLManager
 static void
 DrawTopLeftCornerMask(CGContextRef aCtx, int aRadius)
 {
   CGContextSetRGBFillColor(aCtx, 1.0, 1.0, 1.0, 1.0);
   CGContextFillEllipseInRect(aCtx, CGRectMake(0, 0, aRadius * 2, aRadius * 2));
 }
 
 void
-nsChildView::MaybeDrawRoundedCorners(GLManager* aManager,
-                                     const LayoutDeviceIntRect& aRect)
+nsChildView::MaybeDrawRoundedCorners(GLManager* aManager, const nsIntRect& aRect)
 {
   MutexAutoLock lock(mEffectsLock);
 
   if (!mCornerMaskImage) {
     mCornerMaskImage = new RectTextureImage(aManager->gl());
   }
 
-  LayoutDeviceIntSize size(mDevPixelCornerRadius, mDevPixelCornerRadius);
-  mCornerMaskImage->UpdateIfNeeded(size, LayoutDeviceIntRegion(), ^(gfx::DrawTarget* drawTarget, const LayoutDeviceIntRegion& updateRegion) {
+  nsIntSize size(mDevPixelCornerRadius, mDevPixelCornerRadius);
+  mCornerMaskImage->UpdateIfNeeded(size, nsIntRegion(), ^(gfx::DrawTarget* drawTarget, const nsIntRegion& updateRegion) {
     ClearRegion(drawTarget, updateRegion);
     RefPtr<gfx::PathBuilder> builder = drawTarget->CreatePathBuilder();
     builder->Arc(gfx::Point(mDevPixelCornerRadius, mDevPixelCornerRadius), mDevPixelCornerRadius, 0, 2.0f * M_PI);
     RefPtr<gfx::Path> path = builder->Finish();
     drawTarget->Fill(path,
                      gfx::ColorPattern(gfx::Color(1.0, 1.0, 1.0, 1.0)),
                      gfx::DrawOptions(1.0f, gfx::CompositionOp::OP_SOURCE));
   });
@@ -2392,27 +2387,27 @@ FindUnifiedToolbarBottom(const nsTArray<
         g.mRect.XMost() >= aWindowWidth &&
         g.mRect.Y() <= aTitlebarBottom) {
       unifiedToolbarBottom = std::max(unifiedToolbarBottom, g.mRect.YMost());
     }
   }
   return unifiedToolbarBottom;
 }
 
-static LayoutDeviceIntRect
+static nsIntRect
 FindFirstRectOfType(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
                     nsITheme::ThemeGeometryType aThemeGeometryType)
 {
   for (uint32_t i = 0; i < aThemeGeometries.Length(); ++i) {
     const nsIWidget::ThemeGeometry& g = aThemeGeometries[i];
     if (g.mType == aThemeGeometryType) {
-      return LayoutDeviceIntRect::FromUnknownRect(g.mRect);
+      return g.mRect;
     }
   }
-  return LayoutDeviceIntRect();
+  return nsIntRect();
 }
 
 void
 nsChildView::UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries)
 {
   if (![mView window])
     return;
 
@@ -2434,19 +2429,19 @@ nsChildView::UpdateThemeGeometries(const
   int32_t titlebarHeight = CocoaPointsToDevPixels([win titlebarHeight]);
   int32_t contentOffset = drawsContentsIntoWindowFrame ? titlebarHeight : 0;
   int32_t devUnifiedHeight = titlebarHeight + unifiedToolbarBottom - contentOffset;
   [win setUnifiedToolbarHeight:DevPixelsToCocoaPoints(devUnifiedHeight)];
   int32_t devSheetPosition = titlebarHeight + std::max(toolboxBottom, unifiedToolbarBottom) - contentOffset;
   [win setSheetAttachmentPosition:DevPixelsToCocoaPoints(devSheetPosition)];
 
   // Update titlebar control offsets.
-  LayoutDeviceIntRect windowButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeWindowButtons);
+  nsIntRect windowButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeWindowButtons);
   [win placeWindowButtons:[mView convertRect:DevPixelsToCocoaPoints(windowButtonRect) toView:nil]];
-  LayoutDeviceIntRect fullScreenButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeFullscreenButton);
+  nsIntRect fullScreenButtonRect = FindFirstRectOfType(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeFullscreenButton);
   [win placeFullScreenButton:[mView convertRect:DevPixelsToCocoaPoints(fullScreenButtonRect) toView:nil]];
 }
 
 static nsIntRegion
 GatherThemeGeometryRegion(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
                           nsITheme::ThemeGeometryType aThemeGeometryType)
 {
   nsIntRegion region;
@@ -2632,41 +2627,40 @@ nsChildView::StartRemoteDrawing()
   if (!mGLPresenter) {
     mGLPresenter = GLPresenter::CreateForWindow(this);
 
     if (!mGLPresenter) {
       return nullptr;
     }
   }
 
-  LayoutDeviceIntRegion dirtyRegion(LayoutDeviceIntRect::FromUnknownRect(mBounds));
-  LayoutDeviceIntSize renderSize =
-    LayoutDeviceIntSize::FromUnknownSize(mBounds.Size());
+  nsIntRegion dirtyRegion = mBounds;
+  nsIntSize renderSize = mBounds.Size();
 
   if (!mBasicCompositorImage) {
     mBasicCompositorImage = new RectTextureImage(mGLPresenter->gl());
   }
 
   RefPtr<gfx::DrawTarget> drawTarget =
     mBasicCompositorImage->BeginUpdate(renderSize, dirtyRegion);
 
   if (!drawTarget) {
     // Composite unchanged textures.
-    DoRemoteComposition(LayoutDeviceIntRect::FromUnknownRect(mBounds));
+    DoRemoteComposition(mBounds);
     return nullptr;
   }
 
   return drawTarget.forget();
 }
 
 void
 nsChildView::EndRemoteDrawing()
 {
   mBasicCompositorImage->EndUpdate(true);
-  DoRemoteComposition(LayoutDeviceIntRect::FromUnknownRect(mBounds));
+  DoRemoteComposition(mBounds);
 }
 
 void
 nsChildView::CleanupRemoteDrawing()
 {
   mBasicCompositorImage = nullptr;
   mCornerMaskImage = nullptr;
   mResizerImage = nullptr;
@@ -2683,42 +2677,40 @@ nsChildView::InitCompositor(Compositor* 
     }
 
     return !!mGLPresenter;
   }
   return true;
 }
 
 void
-nsChildView::DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect)
+nsChildView::DoRemoteComposition(const nsIntRect& aRenderRect)
 {
   if (![(ChildView*)mView preRender:mGLPresenter->GetNSOpenGLContext()]) {
     return;
   }
   mGLPresenter->BeginFrame(aRenderRect.Size());
 
   // Draw the result from the basic compositor.
-  mBasicCompositorImage->Draw(mGLPresenter, LayoutDeviceIntPoint(0, 0));
+  mBasicCompositorImage->Draw(mGLPresenter, nsIntPoint(0, 0));
 
   // DrawWindowOverlay doesn't do anything for non-GL, so it didn't paint
   // anything during the basic compositor transaction. Draw the overlay now.
   DrawWindowOverlay(mGLPresenter, aRenderRect);
 
   mGLPresenter->EndFrame();
 
   [(ChildView*)mView postRender:mGLPresenter->GetNSOpenGLContext()];
 }
 
 void
 nsChildView::UpdateWindowDraggingRegion(const nsIntRegion& aRegion)
 {
-  LayoutDeviceIntRegion region =
-    LayoutDeviceIntRegion::FromUnknownRegion(aRegion);
-  if (mDraggableRegion != region) {
-    mDraggableRegion = region;
+  if (mDraggableRegion != aRegion) {
+    mDraggableRegion = aRegion;
     [(ChildView*)mView updateWindowDraggableState];
   }
 }
 
 void
 nsChildView::ReportSwipeStarted(uint64_t aInputBlockId,
                                 bool aStartSwipe)
 {
@@ -2878,40 +2870,39 @@ RectTextureImage::~RectTextureImage()
 {
   if (mTexture) {
     mGLContext->MakeCurrent();
     mGLContext->fDeleteTextures(1, &mTexture);
     mTexture = 0;
   }
 }
 
-LayoutDeviceIntSize
-RectTextureImage::TextureSizeForSize(const LayoutDeviceIntSize& aSize)
-{
-  return LayoutDeviceIntSize(gfx::NextPowerOfTwo(aSize.width),
-                             gfx::NextPowerOfTwo(aSize.height));
+nsIntSize
+RectTextureImage::TextureSizeForSize(const nsIntSize& aSize)
+{
+  return nsIntSize(gfx::NextPowerOfTwo(aSize.width),
+                   gfx::NextPowerOfTwo(aSize.height));
 }
 
 already_AddRefed<gfx::DrawTarget>
-RectTextureImage::BeginUpdate(const LayoutDeviceIntSize& aNewSize,
-                              const LayoutDeviceIntRegion& aDirtyRegion)
+RectTextureImage::BeginUpdate(const nsIntSize& aNewSize,
+                              const nsIntRegion& aDirtyRegion)
 {
   MOZ_ASSERT(!mInUpdate, "Beginning update during update!");
   mUpdateRegion = aDirtyRegion;
   if (aNewSize != mUsedSize) {
     mUsedSize = aNewSize;
-    mUpdateRegion =
-      LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), aNewSize);
+    mUpdateRegion = gfx::IntRect(gfx::IntPoint(0, 0), aNewSize);
   }
 
   if (mUpdateRegion.IsEmpty()) {
     return nullptr;
   }
 
-  LayoutDeviceIntSize neededBufferSize = TextureSizeForSize(mUsedSize);
+  nsIntSize neededBufferSize = TextureSizeForSize(mUsedSize);
   if (!mUpdateDrawTarget || mBufferSize != neededBufferSize) {
     gfx::IntSize size(neededBufferSize.width, neededBufferSize.height);
     mUpdateDrawTarget =
       gfx::Factory::CreateDrawTarget(gfx::BackendType::COREGRAPHICS, size,
                                      gfx::SurfaceFormat::B8G8R8A8);
     mBufferSize = neededBufferSize;
   }
 
@@ -2930,75 +2921,74 @@ CanUploadSubtextures()
 }
 
 void
 RectTextureImage::EndUpdate(bool aKeepSurface)
 {
   MOZ_ASSERT(mInUpdate, "Ending update while not in update");
 
   bool overwriteTexture = false;
-  LayoutDeviceIntRegion updateRegion = mUpdateRegion;
+  nsIntRegion updateRegion = mUpdateRegion;
   if (!mTexture || (mTextureSize != mBufferSize)) {
     overwriteTexture = true;
     mTextureSize = mBufferSize;
   }
 
   if (overwriteTexture || !CanUploadSubtextures()) {
-    updateRegion =
-      LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), mTextureSize);
+    updateRegion = gfx::IntRect(gfx::IntPoint(0, 0), mTextureSize);
   }
 
   RefPtr<gfx::SourceSurface> snapshot = mUpdateDrawTarget->Snapshot();
   RefPtr<gfx::DataSourceSurface> dataSnapshot = snapshot->GetDataSurface();
 
   UploadSurfaceToTexture(mGLContext,
                          dataSnapshot,
-                         updateRegion.ToUnknownRegion(),
+                         updateRegion,
                          mTexture,
                          overwriteTexture,
-                         updateRegion.GetBounds().TopLeft().ToUnknownPoint(),
+                         updateRegion.GetBounds().TopLeft(),
                          false,
                          LOCAL_GL_TEXTURE0,
                          LOCAL_GL_TEXTURE_RECTANGLE_ARB);
 
   if (!aKeepSurface) {
     mUpdateDrawTarget = nullptr;
   }
 
   mInUpdate = false;
 }
 
 void
-RectTextureImage::UpdateFromCGContext(const LayoutDeviceIntSize& aNewSize,
-                                      const LayoutDeviceIntRegion& aDirtyRegion,
+RectTextureImage::UpdateFromCGContext(const nsIntSize& aNewSize,
+                                      const nsIntRegion& aDirtyRegion,
                                       CGContextRef aCGContext)
 {
   gfx::IntSize size = gfx::IntSize(CGBitmapContextGetWidth(aCGContext),
                                    CGBitmapContextGetHeight(aCGContext));
   mBufferSize.SizeTo(size.width, size.height);
   RefPtr<gfx::DrawTarget> dt = BeginUpdate(aNewSize, aDirtyRegion);
   if (dt) {
     gfx::Rect rect(0, 0, size.width, size.height);
-    gfxUtils::ClipToRegion(dt, GetUpdateRegion().ToUnknownRegion());
+    gfxUtils::ClipToRegion(dt, GetUpdateRegion());
     RefPtr<gfx::SourceSurface> sourceSurface =
       dt->CreateSourceSurfaceFromData(static_cast<uint8_t *>(CGBitmapContextGetData(aCGContext)),
                                       size,
                                       CGBitmapContextGetBytesPerRow(aCGContext),
                                       gfx::SurfaceFormat::B8G8R8A8);
     dt->DrawSurface(sourceSurface, rect, rect,
                     gfx::DrawSurfaceOptions(),
                     gfx::DrawOptions(1.0, gfx::CompositionOp::OP_SOURCE));
     dt->PopClip();
     EndUpdate();
   }
 }
 
 void
 RectTextureImage::Draw(GLManager* aManager,
-                       const LayoutDeviceIntPoint& aLocation,
+                       const nsIntPoint& aLocation,
                        const Matrix4x4& aTransform)
 {
   ShaderProgramOGL* program = aManager->GetProgram(LOCAL_GL_TEXTURE_RECTANGLE_ARB,
                                                    gfx::SurfaceFormat::R8G8B8A8);
 
   aManager->gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
   aManager->gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, mTexture);
 
@@ -3081,17 +3071,17 @@ GLPresenter::BindAndDrawQuad(ShaderProgr
                                    LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0,
                                    (GLvoid*)0);
   mGLContext->fEnableVertexAttribArray(coordAttribIndex);
   mGLContext->fDrawArrays(LOCAL_GL_TRIANGLES, 0, 6);
   mGLContext->fDisableVertexAttribArray(coordAttribIndex);
 }
 
 void
-GLPresenter::BeginFrame(LayoutDeviceIntSize aRenderSize)
+GLPresenter::BeginFrame(nsIntSize aRenderSize)
 {
   mGLContext->MakeCurrent();
 
   mGLContext->fViewport(0, 0, aRenderSize.width, aRenderSize.height);
 
   // Matrix to transform (0, 0, width, height) to viewport space (-1.0, 1.0,
   // 2, 2) and flip the contents.
   gfx::Matrix viewMatrix = gfx::Matrix::Translation(-1.0, 1.0);
@@ -3615,28 +3605,28 @@ NSEvent* gLastDragMouseDownEvent = nil;
 - (NSColor*)vibrancyFontSmoothingBackgroundColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType
 {
   if (!mGeckoChild) {
     return [NSColor clearColor];
   }
   return mGeckoChild->VibrancyFontSmoothingBackgroundColorForThemeGeometryType(aThemeGeometryType);
 }
 
-- (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect
-{
-  LayoutDeviceIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
+- (nsIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect
+{
+  nsIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
   const NSRect *rects;
   NSInteger count;
   [self getRectsBeingDrawn:&rects count:&count];
 
   if (count > MAX_RECTS_IN_REGION) {
     return boundingRect;
   }
 
-  LayoutDeviceIntRegion region;
+  nsIntRegion region;
   for (NSInteger i = 0; i < count; ++i) {
     region.Or(region, mGeckoChild->CocoaPointsToDevPixels(rects[i]));
   }
   region.And(region, boundingRect);
   return region;
 }
 
 // The display system has told us that a portion of our view is dirty. Tell
@@ -3703,49 +3693,49 @@ NSEvent* gLastDragMouseDownEvent = nil;
   CGContextSaveGState(aContext);
   CGContextScaleCTM(aContext, 1.0 / scale, 1.0 / scale);
 
   NSSize viewSize = [self bounds].size;
   nsIntSize backingSize(viewSize.width * scale, viewSize.height * scale);
 
   CGContextSaveGState(aContext);
 
-  LayoutDeviceIntRegion region = [self nativeDirtyRegionWithBoundingRect:aRect];
+  nsIntRegion region = [self nativeDirtyRegionWithBoundingRect:aRect];
 
   // Create Cairo objects.
   RefPtr<gfxQuartzSurface> targetSurface;
 
   RefPtr<gfx::DrawTarget> dt =
     gfx::Factory::CreateDrawTargetForCairoCGContext(aContext,
                                                     gfx::IntSize(backingSize.width,
                                                                  backingSize.height));
   MOZ_ASSERT(dt); // see implementation
   dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr);
   RefPtr<gfxContext> targetContext = new gfxContext(dt);
 
   // Set up the clip region.
-  nsIntRegionRectIterator iter(region.ToUnknownRegion());
+  nsIntRegionRectIterator iter(region);
   targetContext->NewPath();
   for (;;) {
     const nsIntRect* r = iter.Next();
     if (!r)
       break;
     targetContext->Rectangle(gfxRect(r->x, r->y, r->width, r->height));
   }
   targetContext->Clip();
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
   bool painted = false;
   if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC) {
     nsBaseWidget::AutoLayerManagerSetup
       setupLayerManager(mGeckoChild, targetContext, BufferMode::BUFFER_NONE);
-    painted = mGeckoChild->PaintWindow(region.ToUnknownRegion());
+    painted = mGeckoChild->PaintWindow(region);
   } else if (mGeckoChild->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
     // We only need this so that we actually get DidPaintWindow fired
-    painted = mGeckoChild->PaintWindow(region.ToUnknownRegion());
+    painted = mGeckoChild->PaintWindow(region);
   }
 
   targetContext = nullptr;
   targetSurface = nullptr;
 
   CGContextRestoreGState(aContext);
 
   // Undo the scale transform so that from now on the context is in
@@ -4565,17 +4555,18 @@ NSEvent* gLastDragMouseDownEvent = nil;
   if (!mGeckoChild)
     return;
 
   NSPoint windowEventLocation = nsCocoaUtils::EventLocationForWindow(aEvent, [self window]);
   NSPoint localEventLocation = [self convertPoint:windowEventLocation fromView:nil];
 
   EventMessage msg = aEnter ? eMouseEnterIntoWidget : eMouseExitFromWidget;
   WidgetMouseEvent event(true, msg, mGeckoChild, WidgetMouseEvent::eReal);
-  event.refPoint = mGeckoChild->CocoaPointsToDevPixels(localEventLocation);
+  event.refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
+    mGeckoChild->CocoaPointsToDevPixels(localEventLocation));
 
   event.exit = aType;
 
   nsEventStatus status; // ignored
   mGeckoChild->DispatchEvent(&event, status);
 }
 
 - (void)updateWindowDraggableState
@@ -4593,25 +4584,25 @@ NSEvent* gLastDragMouseDownEvent = nil;
   // ... and then flip it again because window coordinates have their origin
   // in the bottom left corner, and we need it to be in the top left corner.
   inWindowCoords.origin.y = [[self window] frame].size.height - NSMaxY(inWindowCoords);
   return NSRectToCGRect(inWindowCoords);
 }
 
 static CGSRegionObj
 NewCGSRegionFromRegion(const nsIntRegion& aRegion,
-                       CGRect (^aRectConverter)(const LayoutDeviceIntRect&))
+                       CGRect (^aRectConverter)(const nsIntRect&))
 {
   nsTArray<CGRect> rects;
   nsIntRegionRectIterator iter(aRegion);
   for (;;) {
     const nsIntRect* r = iter.Next();
     if (!r)
       break;
-    rects.AppendElement(aRectConverter(LayoutDeviceIntRect::FromUnknownRect(*r)));
+    rects.AppendElement(aRectConverter(*r));
   }
 
   CGSRegionObj region;
   CGSNewRegionWithRectList(rects.Elements(), rects.Length(), &region);
   return region;
 }
 
 // This function is called with forMove:YES to calculate the draggable region
@@ -4619,22 +4610,22 @@ NewCGSRegionFromRegion(const nsIntRegion
 // is handled on the window server without calling back into our process, so it
 // also works while our app is unresponsive.
 - (CGSRegionObj)_regionForOpaqueDescendants:(NSRect)aRect forMove:(BOOL)aForMove
 {
   if (!aForMove || !mGeckoChild) {
     return [super _regionForOpaqueDescendants:aRect forMove:aForMove];
   }
 
-  LayoutDeviceIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
-
-  LayoutDeviceIntRegion opaqueRegion;
+  nsIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
+
+  nsIntRegion opaqueRegion;
   opaqueRegion.Sub(boundingRect, mGeckoChild->GetDraggableRegion());
 
-  return NewCGSRegionFromRegion(opaqueRegion.ToUnknownRegion(), ^(const LayoutDeviceIntRect& r) {
+  return NewCGSRegionFromRegion(opaqueRegion, ^(const nsIntRect& r) {
     return [self convertToFlippedWindowCoordinates:mGeckoChild->DevPixelsToCocoaPoints(r)];
   });
 }
 
 // Starting with 10.10, in addition to the traditional
 // -[NSView _regionForOpaqueDescendants:forMove:] method, there's a new form with
 // an additional forUnderTitlebar argument, which is sometimes called instead of
 // the old form. We need to override the new variant as well.
@@ -4896,19 +4887,18 @@ PanGestureTypeForEvent(NSEvent* aEvent)
     [self sendWheelCondition:NO
                        first:eWheelOperationStart
                       second:eWheelOperationEnd
                     forEvent:theEvent];
   }
 
   NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(theEvent, [self window]);
 
-  ScreenPoint position = ViewAs<ScreenPixel>(
-    [self convertWindowCoordinates:locationInWindow],
-    PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
+  ScreenPoint position = ScreenPoint::FromUnknownPoint(
+    [self convertWindowCoordinates:locationInWindow]);
 
   bool usePreciseDeltas = nsCocoaUtils::HasPreciseScrollingDeltas(theEvent) &&
     Preferences::GetBool("mousewheel.enable_pixel_scrolling", true);
   bool hasPhaseInformation = nsCocoaUtils::EventHasPhaseInformation(theEvent);
 
   int32_t lineOrPageDeltaX = RoundUp(-[theEvent deltaX]);
   int32_t lineOrPageDeltaY = RoundUp(-[theEvent deltaY]);
 
@@ -4972,38 +4962,35 @@ PanGestureTypeForEvent(NSEvent* aEvent)
   APZCTreeManager* apzctm = [self apzctm];
   if (!apzctm) {
     return;
   }
 
   CGPoint loc = CGEventGetLocation(cgEvent);
   loc.y = nsCocoaUtils::FlippedScreenY(loc.y);
   NSPoint locationInWindow = [[self window] convertScreenToBase:NSPointFromCGPoint(loc)];
-  ScreenIntPoint location = ViewAs<ScreenPixel>(
-    [self convertWindowCoordinates:locationInWindow],
-    PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
+  ScreenIntPoint location = ScreenIntPoint::FromUnknownPoint([self convertWindowCoordinates:locationInWindow]);
 
   static NSTimeInterval sStartTime = [NSDate timeIntervalSinceReferenceDate];
   static TimeStamp sStartTimeStamp = TimeStamp::Now();
 
   if (type == kCGEventScrollWheel) {
     NSEvent* event = [NSEvent eventWithCGEvent:cgEvent];
     NSEventPhase phase = nsCocoaUtils::EventPhase(event);
     NSEventPhase momentumPhase = nsCocoaUtils::EventMomentumPhase(event);
     CGFloat pixelDeltaX = 0, pixelDeltaY = 0;
     nsCocoaUtils::GetScrollingDeltas(event, &pixelDeltaX, &pixelDeltaY);
     uint32_t eventTime = ([event timestamp] - sStartTime) * 1000;
     TimeStamp eventTimeStamp = sStartTimeStamp +
       TimeDuration::FromSeconds([event timestamp] - sStartTime);
     NSPoint locationInWindowMoved = NSMakePoint(
       locationInWindow.x + pixelDeltaX,
       locationInWindow.y - pixelDeltaY);
-    ScreenIntPoint locationMoved = ViewAs<ScreenPixel>(
-      [self convertWindowCoordinates:locationInWindowMoved],
-      PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
+    ScreenIntPoint locationMoved = ScreenIntPoint::FromUnknownPoint(
+      [self convertWindowCoordinates:locationInWindowMoved]);
     ScreenPoint delta = ScreenPoint(locationMoved - location);
     ScrollableLayerGuid guid;
 
     // MayBegin and Cancelled are dispatched when the fingers start or stop
     // touching the touchpad before any scrolling has occurred. These events
     // can be used to control scrollbar visibility or interrupt scroll
     // animations. They are only dispatched on 10.8 or later, and only by
     // relatively modern devices.
@@ -5139,17 +5126,18 @@ PanGestureTypeForEvent(NSEvent* aEvent)
   if (!outGeckoEvent)
     return;
 
   nsCocoaUtils::InitInputEvent(*outGeckoEvent, aMouseEvent);
 
   // convert point to view coordinate system
   NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(aMouseEvent, [self window]);
 
-  outGeckoEvent->refPoint = [self convertWindowCoordinates:locationInWindow];
+  outGeckoEvent->refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
+    [self convertWindowCoordinates:locationInWindow]);
 
   WidgetMouseEventBase* mouseEvent = outGeckoEvent->AsMouseEventBase();
   mouseEvent->buttons = 0;
   NSUInteger mouseButtons = [NSEvent pressedMouseButtons];
 
   if (mouseButtons & 0x01) {
     mouseEvent->buttons |= WidgetMouseEvent::eLeftButtonFlag;
   }
@@ -5589,20 +5577,20 @@ PanGestureTypeForEvent(NSEvent* aEvent)
     return NSDragOperationLink;
   if (nsIDragService::DRAGDROP_ACTION_COPY & aDragAction)
     return NSDragOperationCopy;
   if (nsIDragService::DRAGDROP_ACTION_MOVE & aDragAction)
     return NSDragOperationGeneric;
   return NSDragOperationNone;
 }
 
-- (LayoutDeviceIntPoint)convertWindowCoordinates:(NSPoint)aPoint
+- (nsIntPoint)convertWindowCoordinates:(NSPoint)aPoint
 {
   if (!mGeckoChild) {
-    return LayoutDeviceIntPoint(0, 0);
+    return nsIntPoint(0, 0);
   }
 
   NSPoint localPoint = [self convertPoint:aPoint fromView:nil];
   return mGeckoChild->CocoaPointsToDevPixels(localPoint);
 }
 
 - (APZCTreeManager*)apzctm
 {
@@ -5671,17 +5659,18 @@ PanGestureTypeForEvent(NSEvent* aEvent)
   // set up gecko event
   WidgetDragEvent geckoEvent(true, aMessage, mGeckoChild);
   nsCocoaUtils::InitInputEvent(geckoEvent, [NSApp currentEvent]);
 
   // Use our own coordinates in the gecko event.
   // Convert event from gecko global coords to gecko view coords.
   NSPoint draggingLoc = [aSender draggingLocation];
 
-  geckoEvent.refPoint = [self convertWindowCoordinates:draggingLoc];
+  geckoEvent.refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
+    [self convertWindowCoordinates:draggingLoc]);
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
   mGeckoChild->DispatchInputEvent(&geckoEvent);
   if (!mGeckoChild)
     return NSDragOperationNone;
 
   if (dragSession) {
     switch (aMessage) {
@@ -5777,17 +5766,17 @@ PanGestureTypeForEvent(NSEvent* aEvent)
   if (!dragService) {
     dragService = do_GetService(kDragServiceContractID);
   }
 
   if (dragService) {
     NSPoint pnt = [NSEvent mouseLocation];
     FlipCocoaScreenCoordinate(pnt);
 
-    LayoutDeviceIntPoint devPoint = mGeckoChild->CocoaPointsToDevPixels(pnt);
+    nsIntPoint devPoint = mGeckoChild->CocoaPointsToDevPixels(pnt);
     dragService->DragMoved(devPoint.x, devPoint.y);
   }
 }
 
 // NSDraggingSource
 - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
--- a/widget/cocoa/nsCocoaUtils.h
+++ b/widget/cocoa/nsCocoaUtils.h
@@ -124,18 +124,16 @@ struct KeyBindingsCommand
 
 - (void)insertText:(id)aString;
 
 @end // NativeKeyBindingsRecorder
 
 class nsCocoaUtils
 {
   typedef mozilla::gfx::SourceSurface SourceSurface;
-  typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
-  typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
 
 public:
 
   // Get the backing scale factor from an object that supports this selector
   // (NSView/Window/Screen, on 10.7 or later), returning 1.0 if not supported
   static CGFloat
   GetBackingScaleFactor(id aObject)
   {
@@ -149,60 +147,48 @@ public:
   // Conversions between Cocoa points and device pixels, given the backing
   // scale factor from a view/window/screen.
   static int32_t
   CocoaPointsToDevPixels(CGFloat aPts, CGFloat aBackingScale)
   {
     return NSToIntRound(aPts * aBackingScale);
   }
 
-  static LayoutDeviceIntPoint
+  static nsIntPoint
   CocoaPointsToDevPixels(const NSPoint& aPt, CGFloat aBackingScale)
   {
-    return LayoutDeviceIntPoint(NSToIntRound(aPt.x * aBackingScale),
-                                NSToIntRound(aPt.y * aBackingScale));
+    return nsIntPoint(NSToIntRound(aPt.x * aBackingScale),
+                      NSToIntRound(aPt.y * aBackingScale));
   }
 
-  static LayoutDeviceIntRect
+  static nsIntRect
   CocoaPointsToDevPixels(const NSRect& aRect, CGFloat aBackingScale)
   {
-    return LayoutDeviceIntRect(NSToIntRound(aRect.origin.x * aBackingScale),
-                               NSToIntRound(aRect.origin.y * aBackingScale),
-                               NSToIntRound(aRect.size.width * aBackingScale),
-                               NSToIntRound(aRect.size.height * aBackingScale));
+    return nsIntRect(NSToIntRound(aRect.origin.x * aBackingScale),
+                     NSToIntRound(aRect.origin.y * aBackingScale),
+                     NSToIntRound(aRect.size.width * aBackingScale),
+                     NSToIntRound(aRect.size.height * aBackingScale));
   }
 
   static CGFloat
   DevPixelsToCocoaPoints(int32_t aPixels, CGFloat aBackingScale)
   {
     return (CGFloat)aPixels / aBackingScale;
   }
 
   static NSPoint
   DevPixelsToCocoaPoints(const mozilla::LayoutDeviceIntPoint& aPt,
                          CGFloat aBackingScale)
   {
     return NSMakePoint((CGFloat)aPt.x / aBackingScale,
                        (CGFloat)aPt.y / aBackingScale);
   }
 
-  // XXX: all calls to this function should eventually be replaced with calls
-  // to DevPixelsToCocoaPoints().
   static NSRect
-  UntypedDevPixelsToCocoaPoints(const nsIntRect& aRect, CGFloat aBackingScale)
-  {
-    return NSMakeRect((CGFloat)aRect.x / aBackingScale,
-                      (CGFloat)aRect.y / aBackingScale,
-                      (CGFloat)aRect.width / aBackingScale,
-                      (CGFloat)aRect.height / aBackingScale);
-  }
-
-  static NSRect
-  DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect,
-                         CGFloat aBackingScale)
+  DevPixelsToCocoaPoints(const nsIntRect& aRect, CGFloat aBackingScale)
   {
     return NSMakeRect((CGFloat)aRect.x / aBackingScale,
                       (CGFloat)aRect.y / aBackingScale,
                       (CGFloat)aRect.width / aBackingScale,
                       (CGFloat)aRect.height / aBackingScale);
   }
 
   // Returns the given y coordinate, which must be in screen coordinates,
@@ -226,18 +212,18 @@ public:
 
   // Converts aGeckoRect in dev pixels to points in Cocoa coordinates
   static NSRect GeckoRectToCocoaRectDevPix(const nsIntRect &aGeckoRect,
                                            CGFloat aBackingScale);
 
   // See explanation for geckoRectToCocoaRect, guess what this does...
   static nsIntRect CocoaRectToGeckoRect(const NSRect &cocoaRect);
 
-  static mozilla::LayoutDeviceIntRect CocoaRectToGeckoRectDevPix(
-    const NSRect& aCocoaRect, CGFloat aBackingScale);
+  static nsIntRect CocoaRectToGeckoRectDevPix(const NSRect &aCocoaRect,
+                                              CGFloat aBackingScale);
 
   // Gives the location for the event in screen coordinates. Do not call this
   // unless the window the event was originally targeted at is still alive!
   // anEvent may be nil -- in that case the current mouse location is returned.
   static NSPoint ScreenLocationForEvent(NSEvent* anEvent);
   
   // Determines if an event happened over a window, whether or not the event
   // is for the window. Does not take window z-order into account.
--- a/widget/cocoa/nsCocoaUtils.mm
+++ b/widget/cocoa/nsCocoaUtils.mm
@@ -92,20 +92,20 @@ nsIntRect nsCocoaUtils::CocoaRectToGecko
   nsIntRect rect;
   rect.x = NSToIntRound(cocoaRect.origin.x);
   rect.y = NSToIntRound(FlippedScreenY(cocoaRect.origin.y + cocoaRect.size.height));
   rect.width = NSToIntRound(cocoaRect.origin.x + cocoaRect.size.width) - rect.x;
   rect.height = NSToIntRound(FlippedScreenY(cocoaRect.origin.y)) - rect.y;
   return rect;
 }
 
-LayoutDeviceIntRect nsCocoaUtils::CocoaRectToGeckoRectDevPix(
-  const NSRect& aCocoaRect, CGFloat aBackingScale)
+nsIntRect nsCocoaUtils::CocoaRectToGeckoRectDevPix(const NSRect &aCocoaRect,
+                                                   CGFloat aBackingScale)
 {
-  LayoutDeviceIntRect rect;
+  nsIntRect rect;
   rect.x = NSToIntRound(aCocoaRect.origin.x * aBackingScale);
   rect.y = NSToIntRound(FlippedScreenY(aCocoaRect.origin.y + aCocoaRect.size.height) * aBackingScale);
   rect.width = NSToIntRound((aCocoaRect.origin.x + aCocoaRect.size.width) * aBackingScale) - rect.x;
   rect.height = NSToIntRound(FlippedScreenY(aCocoaRect.origin.y) * aBackingScale) - rect.y;
   return rect;
 }
 
 NSPoint nsCocoaUtils::ScreenLocationForEvent(NSEvent* anEvent)
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -1568,53 +1568,54 @@ NS_IMETHODIMP nsCocoaWindow::Resize(doub
 }
 
 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()).ToUnknownRect();
+  mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
 }
 
 NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
 #ifdef DEBUG
-  LayoutDeviceIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
-  NS_ASSERTION(mWindow && mBounds == r.ToUnknownRect(), "mBounds out of sync!");
+  nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
+  NS_ASSERTION(mWindow && mBounds == r, "mBounds out of sync!");
 #endif
 
   aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
@@ -1980,23 +1981,23 @@ NS_IMETHODIMP nsCocoaWindow::SetFocus(bo
   return NS_OK;
 }
 
 LayoutDeviceIntPoint nsCocoaWindow::WidgetToScreenOffset()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   NSRect rect = NSZeroRect;
-  LayoutDeviceIntRect r;
+  nsIntRect r;
   if (mWindow) {
     rect = [mWindow contentRectForFrameRect:[mWindow frame]];
   }
   r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(rect, BackingScaleFactor());
 
-  return r.TopLeft();
+  return LayoutDeviceIntPoint::FromUnknownPoint(r.TopLeft());
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
 }
 
 LayoutDeviceIntPoint nsCocoaWindow::GetClientOffset()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
@@ -2013,22 +2014,22 @@ LayoutDeviceIntSize
 nsCocoaWindow::ClientToWindowSize(const LayoutDeviceIntSize& aClientSize)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   if (!mWindow)
     return LayoutDeviceIntSize(0, 0);
 
   CGFloat backingScale = BackingScaleFactor();
-  LayoutDeviceIntRect r(0, 0, aClientSize.width, aClientSize.height);
+  nsIntRect r(0, 0, aClientSize.width, aClientSize.height);
   NSRect rect = nsCocoaUtils::DevPixelsToCocoaPoints(r, backingScale);
 
   NSRect inflatedRect = [mWindow frameRectForContentRect:rect];
   r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(inflatedRect, backingScale);
-  return r.Size();
+  return LayoutDeviceIntSize(r.width, r.height);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntSize(0,0));
 }
 
 nsMenuBarX* nsCocoaWindow::GetMenuBar()
 {
   return mMenuBar;
 }
--- a/widget/cocoa/nsScreenCocoa.mm
+++ b/widget/cocoa/nsScreenCocoa.mm
@@ -39,34 +39,32 @@ nsScreenCocoa::GetId(uint32_t *outId)
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 NS_IMETHODIMP
 nsScreenCocoa::GetRect(int32_t *outX, int32_t *outY, int32_t *outWidth, int32_t *outHeight)
 {
   NSRect frame = [mScreen frame];
 
-  LayoutDeviceIntRect r =
-    nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
+  nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
 
   *outX = r.x;
   *outY = r.y;
   *outWidth = r.width;
   *outHeight = r.height;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsScreenCocoa::GetAvailRect(int32_t *outX, int32_t *outY, int32_t *outWidth, int32_t *outHeight)
 {
   NSRect frame = [mScreen visibleFrame];
 
-  LayoutDeviceIntRect r =
-    nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
+  nsIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
 
   *outX = r.x;
   *outY = r.y;
   *outWidth = r.width;
   *outHeight = r.height;
 
   return NS_OK;
 }
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1474,17 +1474,17 @@ nsBaseWidget::SetIcon(const nsAString&)
 
 NS_IMETHODIMP
 nsBaseWidget::SetWindowTitlebarColor(nscolor aColor, bool aActive)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 bool
-nsBaseWidget::ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect)
+nsBaseWidget::ShowsResizeIndicator(nsIntRect* aResizerRect)
 {
   return false;
 }
 
 NS_IMETHODIMP
 nsBaseWidget::OverrideSystemMouseScrollSpeed(double aOriginalDeltaX,
                                              double aOriginalDeltaY,
                                              double& aOverriddenDeltaX,
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -162,17 +162,17 @@ public:
   virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight);
   virtual void            CreateCompositor();
   virtual void            CreateCompositor(int aWidth, int aHeight);
   virtual void            PrepareWindowEffects() override {}
   virtual void            CleanupWindowEffects() override {}
   virtual bool            PreRender(LayerManagerComposite* aManager) override { return true; }
   virtual void            PostRender(LayerManagerComposite* aManager) override {}
   virtual void            DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) override {}
-  virtual void            DrawWindowOverlay(LayerManagerComposite* aManager, LayoutDeviceIntRect aRect) override {}
+  virtual void            DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) override {}
   virtual already_AddRefed<mozilla::gfx::DrawTarget> StartRemoteDrawing() override;
   virtual void            EndRemoteDrawing() override { };
   virtual void            CleanupRemoteDrawing() override { };
   virtual void            UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override {}
   NS_IMETHOD              SetModal(bool aModal) override;
   virtual uint32_t        GetMaxTouchPoints() const override;
   NS_IMETHOD              SetWindowClass(const nsAString& xulWinType) override;
   virtual nsresult        SetWindowClipRegion(const nsTArray<nsIntRect>& aRects, bool aIntersectWithExisting) override;
@@ -197,17 +197,17 @@ public:
   NS_IMETHOD              SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
   virtual LayoutDeviceIntPoint 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;
   virtual void            SetDrawsInTitlebar(bool aState) override {}
-  virtual bool            ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
+  virtual bool            ShowsResizeIndicator(nsIntRect* aResizerRect) override;
   virtual void            FreeNativeData(void * data, uint32_t aDataType) override {}
   NS_IMETHOD              BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
                                           int32_t aHorizontal,
                                           int32_t aVertical) override;
   NS_IMETHOD              BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) override;
   virtual nsresult        ActivateNativeMenuItemAt(const nsAString& indexString) override { return NS_ERROR_NOT_IMPLEMENTED; }
   virtual nsresult        ForceUpdateNativeMenuAt(const nsAString& indexString) override { return NS_ERROR_NOT_IMPLEMENTED; }
   NS_IMETHOD              NotifyIME(const IMENotification& aIMENotification) override final;
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -330,17 +330,16 @@ class nsIWidget : public nsISupports {
     typedef mozilla::widget::InputContext InputContext;
     typedef mozilla::widget::InputContextAction InputContextAction;
     typedef mozilla::widget::SizeConstraints SizeConstraints;
     typedef mozilla::widget::TextEventDispatcher TextEventDispatcher;
     typedef mozilla::CompositorVsyncDispatcher CompositorVsyncDispatcher;
     typedef mozilla::LayoutDeviceIntMargin LayoutDeviceIntMargin;
     typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
     typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
-    typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion;
     typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize;
 
     // Used in UpdateThemeGeometries.
     struct ThemeGeometry {
       // The ThemeGeometryType value for the themed widget, see
       // nsITheme::ThemeGeometryTypeForWidget.
       nsITheme::ThemeGeometryType mType;
       // The device-pixel rect within the window for the themed widget
@@ -1254,18 +1253,17 @@ class nsIWidget : public nsISupports {
      */
     virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0;
 
     /**
      * Called after the LayerManager draws the layer tree
      *
      * Always called from the compositing thread.
      */
-    virtual void DrawWindowOverlay(LayerManagerComposite* aManager,
-                                   LayoutDeviceIntRect aRect) = 0;
+    virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0;
 
     /**
      * Return a DrawTarget for the window which can be composited into.
      *
      * Called by BasicCompositor on the compositor thread for OMTC drawing
      * before each composition.
      */
     virtual already_AddRefed<mozilla::gfx::DrawTarget> StartRemoteDrawing() = 0;
@@ -1497,17 +1495,17 @@ class nsIWidget : public nsISupports {
      * Determine whether the widget shows a resize widget. If it does,
      * aResizerRect returns the resizer's rect.
      *
      * Returns false on any platform that does not support it.
      *
      * @param aResizerRect The resizer's rect in device pixels.
      * @return Whether a resize widget is shown.
      */
-    virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) = 0;
+    virtual bool ShowsResizeIndicator(nsIntRect* aResizerRect) = 0;
 
     /**
      * Return the popup that was last rolled up, or null if there isn't one.
      */
     virtual nsIContent* GetLastRollup() = 0;
 
     /**
      * Begin a window resizing drag, based on the event passed in.