Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
authorMilan Sreckovic <milan@mozilla.com>
Wed, 10 Jan 2018 11:14:16 -0500
changeset 398636 ef2f9e08e01238ae5893951fa13aafdaa3146f45
parent 398635 72da6def61e02e510a85141027143ccb060d1d77
child 398637 3d470c01d770337da1c1f14e4b29d9ba041e749e
push id33226
push useraciure@mozilla.com
push dateThu, 11 Jan 2018 09:43:46 +0000
treeherdermozilla-central@c2953fa35771 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1423559
milestone59.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 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange MozReview-Commit-ID: AqnztoUbsmk
widget/CompositorWidget.cpp
widget/ContentCache.cpp
widget/IMEData.h
widget/PuppetWidget.cpp
widget/PuppetWidget.h
widget/Screen.cpp
widget/ScreenManager.cpp
widget/WidgetUtils.cpp
widget/cocoa/nsCocoaUtils.h
widget/headless/HeadlessWidget.cpp
widget/nsBaseDragService.cpp
widget/nsBaseWidget.cpp
widget/nsNativeTheme.cpp
widget/windows/IMMHandler.cpp
widget/windows/ScreenHelperWin.cpp
widget/windows/TSFTextStore.cpp
widget/windows/WinUtils.cpp
widget/windows/nsDragService.cpp
widget/windows/nsNativeThemeWin.cpp
widget/windows/nsPrintDialogUtil.cpp
widget/windows/nsWindow.cpp
--- a/widget/CompositorWidget.cpp
+++ b/widget/CompositorWidget.cpp
@@ -48,17 +48,17 @@ CompositorWidget::GetBackBufferDrawTarge
       mLastBackBuffer->GetBackendType() == aScreenTarget->GetBackendType() &&
       mLastBackBuffer->GetFormat() == format &&
       size <= mLastBackBuffer->GetSize() &&
       mLastBackBuffer->GetSize() <= clientSize) {
     target = mLastBackBuffer;
     target->SetTransform(gfx::Matrix());
     if (!aClearRect.IsEmpty()) {
       gfx::IntRect clearRect = aClearRect.ToUnknownRect() - aRect.ToUnknownRect().TopLeft();
-      target->ClearRect(gfx::Rect(clearRect.x, clearRect.y, clearRect.width, clearRect.height));
+      target->ClearRect(gfx::Rect(clearRect.X(), clearRect.Y(), clearRect.Width(), clearRect.Height()));
     }
   } else {
     target = aScreenTarget->CreateSimilarDrawTarget(size, format);
     mLastBackBuffer = target;
   }
   return target.forget();
 }
 
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -39,23 +39,23 @@ GetNotificationName(const IMENotificatio
 }
 
 class GetRectText : public nsAutoCString
 {
 public:
   explicit GetRectText(const LayoutDeviceIntRect& aRect)
   {
     AssignLiteral("{ x=");
-    AppendInt(aRect.x);
+    AppendInt(aRect.X());
     AppendLiteral(", y=");
-    AppendInt(aRect.y);
+    AppendInt(aRect.Y());
     AppendLiteral(", width=");
-    AppendInt(aRect.width);
+    AppendInt(aRect.Width());
     AppendLiteral(", height=");
-    AppendInt(aRect.height);
+    AppendInt(aRect.Height());
     AppendLiteral(" }");
   }
   virtual ~GetRectText() {}
 };
 
 class GetWritingModeName : public nsAutoCString
 {
 public:
@@ -288,21 +288,21 @@ ContentCacheInChild::QueryCharRect(nsIWi
   textRect.InitForQueryTextRect(aOffset, 1);
   aWidget->DispatchEvent(&textRect, status);
   if (NS_WARN_IF(!textRect.mSucceeded)) {
     return false;
   }
   aCharRect = textRect.mReply.mRect;
 
   // Guarantee the rect is not empty.
-  if (NS_WARN_IF(!aCharRect.height)) {
-    aCharRect.height = 1;
+  if (NS_WARN_IF(!aCharRect.Height())) {
+    aCharRect.SetHeight(1);
   }
-  if (NS_WARN_IF(!aCharRect.width)) {
-    aCharRect.width = 1;
+  if (NS_WARN_IF(!aCharRect.Width())) {
+    aCharRect.SetWidth(1);
   }
   return true;
 }
 
 bool
 ContentCacheInChild::QueryCharRectArray(nsIWidget* aWidget,
                                         uint32_t aOffset,
                                         uint32_t aLength,
@@ -1076,30 +1076,30 @@ ContentCacheInParent::GetCaretRect(uint3
     // guess the caret rect with it.
     if (!aOffset ||
         !GetTextRect(aOffset - 1, aRoundToExistingOffset, aCaretRect)) {
       aCaretRect.SetEmpty();
       return false;
     }
 
     if (mSelection.mWritingMode.IsVertical()) {
-      aCaretRect.y = aCaretRect.YMost();
+      aCaretRect.MoveToY(aCaretRect.YMost());
     } else {
       // XXX bidi-unaware.
-      aCaretRect.x = aCaretRect.XMost();
+      aCaretRect.MoveToX(aCaretRect.XMost());
     }
   }
 
   // XXX This is not bidi aware because we don't cache each character's
   //     direction.  However, this is usually used by IME, so, assuming the
   //     character is in LRT context must not cause any problem.
   if (mSelection.mWritingMode.IsVertical()) {
-    aCaretRect.height = mCaret.IsValid() ? mCaret.mRect.height : 1;
+    aCaretRect.SetHeight(mCaret.IsValid() ? mCaret.mRect.Height() : 1);
   } else {
-    aCaretRect.width = mCaret.IsValid() ? mCaret.mRect.width : 1;
+    aCaretRect.SetWidth(mCaret.IsValid() ? mCaret.mRect.Width() : 1);
   }
   return true;
 }
 
 bool
 ContentCacheInParent::OnCompositionEvent(const WidgetCompositionEvent& aEvent)
 {
   MOZ_LOG(sContentCacheLog, LogLevel::Info,
--- a/widget/IMEData.h
+++ b/widget/IMEData.h
@@ -655,20 +655,17 @@ struct IMENotification final
   {
     int32_t mX;
     int32_t mY;
     int32_t mWidth;
     int32_t mHeight;
 
     void Set(const nsIntRect& aRect)
     {
-      mX = aRect.x;
-      mY = aRect.y;
-      mWidth = aRect.Width();
-      mHeight = aRect.Height();
+      aRect.GetRect(&mX, &mY, &mWidth, &mHeight);
     }
     nsIntRect AsIntRect() const
     {
       return nsIntRect(mX, mY, mWidth, mHeight);
     }
   };
 
   // NOTIFY_IME_OF_SELECTION_CHANGE specific data
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -129,17 +129,17 @@ PuppetWidget::InfallibleCreate(nsIWidget
   mNeedIMEStateInit = MightNeedIMEFocus(aInitData);
 
   PuppetWidget* parent = static_cast<PuppetWidget*>(aParent);
   if (parent) {
     parent->SetChild(this);
     mLayerManager = parent->GetLayerManager();
   }
   else {
-    Resize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, false);
+    Resize(mBounds.X(), mBounds.Y(), mBounds.Width(), mBounds.Height(), false);
   }
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   if (obs) {
     mMemoryPressureObserver = new MemoryPressureObserver(this);
     obs->AddObserver(mMemoryPressureObserver, "memory-pressure", false);
   }
 }
 
@@ -219,17 +219,17 @@ PuppetWidget::Show(bool aState)
     // we're transitioning from page to page without dropping
     // layers (since we'll continue to show the old layers
     // associated with that old widget listener). If the
     // PuppetWidget was hidden, those layers are dropped,
     // so the previously attached widget listener is really
     // of no use anymore (and is actually actively harmful - see
     // bug 1323586).
     mPreviouslyAttachedWidgetListener = nullptr;
-    Resize(mBounds.width, mBounds.height, false);
+    Resize(mBounds.Width(), mBounds.Height(), false);
     Invalidate(mBounds);
   }
 }
 
 void
 PuppetWidget::Resize(double aWidth,
                      double aHeight,
                      bool   aRepaint)
@@ -252,38 +252,38 @@ PuppetWidget::Resize(double aWidth,
   }
 
   // call WindowResized() on both the current listener, and possibly
   // also the previous one if we're in a state where we're drawing that one
   // because the current one is paint suppressed
   if (!oldBounds.IsEqualEdges(mBounds) && mAttachedWidgetListener) {
     if (GetCurrentWidgetListener() &&
         GetCurrentWidgetListener() != mAttachedWidgetListener) {
-      GetCurrentWidgetListener()->WindowResized(this, mBounds.width, mBounds.height);
+      GetCurrentWidgetListener()->WindowResized(this, mBounds.Width(), mBounds.Height());
     }
-    mAttachedWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
+    mAttachedWidgetListener->WindowResized(this, mBounds.Width(), mBounds.Height());
   }
 }
 
 nsresult
 PuppetWidget::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
 {
   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);
     LayoutDeviceIntRect bounds = w->GetBounds();
     if (bounds.Size() != configuration.mBounds.Size()) {
-      w->Resize(configuration.mBounds.x, configuration.mBounds.y,
-                configuration.mBounds.width, configuration.mBounds.height,
+      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->Move(configuration.mBounds.X(), configuration.mBounds.Y());
     }
     w->SetWindowClipRegion(configuration.mClipRegion, false);
   }
   return NS_OK;
 }
 
 nsresult
 PuppetWidget::SetFocus(bool aRaise)
@@ -1309,28 +1309,25 @@ ScreenConfig()
   hal::GetCurrentScreenConfiguration(&config);
   return config;
 }
 
 nsIntSize
 PuppetWidget::GetScreenDimensions()
 {
   nsIntRect r = ScreenConfig().rect();
-  return nsIntSize(r.width, r.height);
+  return nsIntSize(r.Width(), r.Height());
 }
 
 NS_IMETHODIMP
 PuppetScreen::GetRect(int32_t *outLeft,  int32_t *outTop,
                       int32_t *outWidth, int32_t *outHeight)
 {
   nsIntRect r = ScreenConfig().rect();
-  *outLeft = r.x;
-  *outTop = r.y;
-  *outWidth = r.width;
-  *outHeight = r.height;
+  r.GetRect(outLeft, outTop, outWidth, outHeight);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PuppetScreen::GetAvailRect(int32_t *outLeft,  int32_t *outTop,
                            int32_t *outWidth, int32_t *outHeight)
 {
   return GetRect(outLeft, outTop, outWidth, outHeight);
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -103,21 +103,20 @@ public:
                       double aHeight,
                       bool   aRepaint) override;
   virtual void Resize(double aX,
                       double aY,
                       double aWidth,
                       double aHeight,
                       bool   aRepaint) override
   {
-    if (mBounds.x != aX || mBounds.y != aY) {
+    if (!mBounds.IsEqualXY(aX, aY)) {
       NotifyWindowMoved(aX, aY);
     }
-    mBounds.x = aX;
-    mBounds.y = aY;
+    mBounds.MoveTo(aX, aY);
     return Resize(aWidth, aHeight, aRepaint);
   }
 
   // XXX/cjones: copying gtk behavior here; unclear what disabling a
   // widget is supposed to entail
   virtual void Enable(bool aState) override
   { mEnabled = aState; }
   virtual bool IsEnabled() const override
--- a/widget/Screen.cpp
+++ b/widget/Screen.cpp
@@ -65,59 +65,47 @@ Screen::ToScreenDetails()
 }
 
 NS_IMETHODIMP
 Screen::GetRect(int32_t* aOutLeft,
                 int32_t* aOutTop,
                 int32_t* aOutWidth,
                 int32_t* aOutHeight)
 {
-  *aOutLeft = mRect.x;
-  *aOutTop = mRect.y;
-  *aOutWidth = mRect.width;
-  *aOutHeight = mRect.height;
+  mRect.GetRect(aOutLeft, aOutTop, aOutWidth, aOutHeight);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Screen::GetRectDisplayPix(int32_t* aOutLeft,
                           int32_t* aOutTop,
                           int32_t* aOutWidth,
                           int32_t* aOutHeight)
 {
-  *aOutLeft = mRectDisplayPix.x;
-  *aOutTop = mRectDisplayPix.y;
-  *aOutWidth = mRectDisplayPix.width;
-  *aOutHeight = mRectDisplayPix.height;
+  mRectDisplayPix.GetRect(aOutLeft, aOutTop, aOutWidth, aOutHeight);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Screen::GetAvailRect(int32_t* aOutLeft,
                      int32_t* aOutTop,
                      int32_t* aOutWidth,
                      int32_t* aOutHeight)
 {
-  *aOutLeft = mAvailRect.x;
-  *aOutTop = mAvailRect.y;
-  *aOutWidth = mAvailRect.width;
-  *aOutHeight = mAvailRect.height;
+  mAvailRect.GetRect(aOutLeft, aOutTop, aOutWidth, aOutHeight);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Screen::GetAvailRectDisplayPix(int32_t* aOutLeft,
                                int32_t* aOutTop,
                                int32_t* aOutWidth,
                                int32_t* aOutHeight)
 {
-  *aOutLeft = mAvailRectDisplayPix.x;
-  *aOutTop = mAvailRectDisplayPix.y;
-  *aOutWidth = mAvailRectDisplayPix.width;
-  *aOutHeight = mAvailRectDisplayPix.height;
+  mAvailRectDisplayPix.GetRect(aOutLeft, aOutTop, aOutWidth, aOutHeight);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Screen::GetPixelDepth(int32_t* aPixelDepth)
 {
   *aPixelDepth = mPixelDepth;
   return NS_OK;
--- a/widget/ScreenManager.cpp
+++ b/widget/ScreenManager.cpp
@@ -151,17 +151,17 @@ ScreenManager::ScreenForRect(int32_t aX,
   DesktopIntRect windowRect(aX, aY, aWidth, aHeight);
   for (auto& screen : mScreenList) {
     int32_t  x, y, width, height;
     x = y = width = height = 0;
     screen->GetRectDisplayPix(&x, &y, &width, &height);
     // calculate the surface area
     DesktopIntRect screenRect(x, y, width, height);
     screenRect.IntersectRect(screenRect, windowRect);
-    uint32_t tempArea = screenRect.width * screenRect.height;
+    uint32_t tempArea = screenRect.Area();
     if (tempArea > area) {
       which = screen.get();
       area = tempArea;
     }
   }
 
   // If the rect intersects one or more screen,
   // return the screen that has the largest intersection.
--- a/widget/WidgetUtils.cpp
+++ b/widget/WidgetUtils.cpp
@@ -28,25 +28,25 @@ ComputeTransformForRotation(const nsIntR
 {
     gfx::Matrix transform;
     static const gfx::Float floatPi = static_cast<gfx::Float>(M_PI);
 
     switch (aRotation) {
     case ROTATION_0:
         break;
     case ROTATION_90:
-        transform.PreTranslate(aBounds.width, 0);
+        transform.PreTranslate(aBounds.Width(), 0);
         transform.PreRotate(floatPi / 2);
         break;
     case ROTATION_180:
-        transform.PreTranslate(aBounds.width, aBounds.height);
+        transform.PreTranslate(aBounds.Width(), aBounds.Height());
         transform.PreRotate(floatPi);
         break;
     case ROTATION_270:
-        transform.PreTranslate(0, aBounds.height);
+        transform.PreTranslate(0, aBounds.Height());
         transform.PreRotate(floatPi * 3 / 2);
         break;
     default:
         MOZ_CRASH("Unknown rotation");
     }
     return transform;
 }
 
@@ -56,52 +56,52 @@ ComputeTransformForUnRotation(const nsIn
 {
     gfx::Matrix transform;
     static const gfx::Float floatPi = static_cast<gfx::Float>(M_PI);
 
     switch (aRotation) {
     case ROTATION_0:
         break;
     case ROTATION_90:
-        transform.PreTranslate(0, aBounds.height);
+        transform.PreTranslate(0, aBounds.Height());
         transform.PreRotate(floatPi * 3 / 2);
         break;
     case ROTATION_180:
-        transform.PreTranslate(aBounds.width, aBounds.height);
+        transform.PreTranslate(aBounds.Width(), aBounds.Height());
         transform.PreRotate(floatPi);
         break;
     case ROTATION_270:
-        transform.PreTranslate(aBounds.width, 0);
+        transform.PreTranslate(aBounds.Width(), 0);
         transform.PreRotate(floatPi / 2);
         break;
     default:
         MOZ_CRASH("Unknown rotation");
     }
     return transform;
 }
 
 nsIntRect RotateRect(nsIntRect aRect,
                      const nsIntRect& aBounds,
                      ScreenRotation aRotation)
 {
   switch (aRotation) {
     case ROTATION_0:
       return aRect;
     case ROTATION_90:
-      return nsIntRect(aRect.y,
-                       aBounds.width - aRect.x - aRect.width,
-                       aRect.height, aRect.width);
+      return nsIntRect(aRect.Y(),
+                       aBounds.Width() - aRect.XMost(),
+                       aRect.Height(), aRect.Width());
     case ROTATION_180:
-      return nsIntRect(aBounds.width - aRect.x - aRect.width,
-                       aBounds.height - aRect.y - aRect.height,
-                       aRect.width, aRect.height);
+      return nsIntRect(aBounds.Width() - aRect.XMost(),
+                       aBounds.Height() - aRect.YMost(),
+                       aRect.Width(), aRect.Height());
     case ROTATION_270:
-      return nsIntRect(aBounds.height - aRect.y - aRect.height,
-                       aRect.x,
-                       aRect.height, aRect.width);
+      return nsIntRect(aBounds.Height() - aRect.YMost(),
+                       aRect.X(),
+                       aRect.Height(), aRect.Width());
     default:
       MOZ_CRASH("Unknown rotation");
   }
 }
 
 namespace widget {
 
 uint32_t
--- a/widget/cocoa/nsCocoaUtils.h
+++ b/widget/cocoa/nsCocoaUtils.h
@@ -187,20 +187,20 @@ public:
   {
     return [aWindow convertRectToScreen:NSMakeRect(aPt.x, aPt.y, 0, 0)].origin;
   }
 
   static NSRect
   DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect,
                          CGFloat aBackingScale)
   {
-    return NSMakeRect((CGFloat)aRect.x / aBackingScale,
-                      (CGFloat)aRect.y / aBackingScale,
-                      (CGFloat)aRect.width / aBackingScale,
-                      (CGFloat)aRect.height / 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,
   // flipped from Gecko to Cocoa or Cocoa to Gecko.
   static float FlippedScreenY(float y);
 
   // The following functions come in "DevPix" variants that work with
   // backing-store (device pixel) coordinates, as well as the original
--- a/widget/headless/HeadlessWidget.cpp
+++ b/widget/headless/HeadlessWidget.cpp
@@ -273,23 +273,22 @@ HeadlessWidget::Move(double aX, double a
   if (mWindowType == eWindowType_toplevel ||
       mWindowType == eWindowType_dialog) {
       SetSizeMode(nsSizeMode_Normal);
   }
 
   // Since a popup window's x/y coordinates are in relation to
   // the parent, the parent might have moved so we always move a
   // popup window.
-  if (x == mBounds.x && y == mBounds.y &&
+  if (mBounds.IsEqualXY(x, y) &&
       mWindowType != eWindowType_popup) {
     return;
   }
 
-  mBounds.x = x;
-  mBounds.y = y;
+  mBounds.MoveTo(x, y);
   NotifyRollupGeometryChange();
 }
 
 LayoutDeviceIntPoint
 HeadlessWidget::WidgetToScreenOffset()
 {
   return mTopLevel->GetBounds().TopLeft();
 }
@@ -320,34 +319,34 @@ HeadlessWidget::Resize(double aWidth,
                        bool   aRepaint)
 {
   int32_t width = NSToIntRound(aWidth);
   int32_t height = NSToIntRound(aHeight);
   ConstrainSize(&width, &height);
   mBounds.SizeTo(LayoutDeviceIntSize(width, height));
 
   if (mCompositorWidget) {
-    mCompositorWidget->NotifyClientSizeChanged(LayoutDeviceIntSize(mBounds.width, mBounds.height));
+    mCompositorWidget->NotifyClientSizeChanged(LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()));
   }
   if (mWidgetListener) {
-    mWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
+    mWidgetListener->WindowResized(this, mBounds.Width(), mBounds.Height());
   }
   if (mAttachedWidgetListener) {
-    mAttachedWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
+    mAttachedWidgetListener->WindowResized(this, mBounds.Width(), mBounds.Height());
   }
 }
 
 void
 HeadlessWidget::Resize(double aX,
                        double aY,
                        double aWidth,
                        double aHeight,
                        bool   aRepaint)
 {
-  if (mBounds.x != aX || mBounds.y != aY) {
+  if (!mBounds.IsEqualXY(aX, aY)) {
     NotifyWindowMoved(aX, aY);
   }
   return Resize(aWidth, aHeight, aRepaint);
 }
 
 void
 HeadlessWidget::SetSizeMode(nsSizeMode aMode)
 {
@@ -375,17 +374,17 @@ HeadlessWidget::ApplySizeModeSideEffects
   if (mEffectiveSizeMode == nsSizeMode_Normal) {
     // Store the last normal size bounds so it can be restored when entering
     // normal mode again.
     mRestoreBounds = mBounds;
   }
 
   switch(mSizeMode) {
   case nsSizeMode_Normal: {
-    Resize(mRestoreBounds.x, mRestoreBounds.y, mRestoreBounds.width, mRestoreBounds.height, false);
+    Resize(mRestoreBounds.X(), mRestoreBounds.Y(), mRestoreBounds.Width(), mRestoreBounds.Height(), false);
     break;
   }
   case nsSizeMode_Minimized:
     break;
   case nsSizeMode_Maximized: {
     nsCOMPtr<nsIScreen> screen = GetWidgetScreen();
     if (screen) {
       int32_t left, top, width, height;
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -538,19 +538,19 @@ nsBaseDragService::DrawDrag(nsIDOMNode* 
                             LayoutDeviceIntRect* aScreenDragRect,
                             RefPtr<SourceSurface>* aSurface,
                             nsPresContext** aPresContext)
 {
   *aSurface = nullptr;
   *aPresContext = nullptr;
 
   // use a default size, in case of an error.
-  aScreenDragRect->MoveTo(aScreenPosition.x - mImageOffset.x,
-                          aScreenPosition.y - mImageOffset.y);
-  aScreenDragRect->SizeTo(1, 1);
+  aScreenDragRect->SetRect(aScreenPosition.x - mImageOffset.x,
+                           aScreenPosition.y - mImageOffset.y,
+                           1, 1);
 
   // if a drag image was specified, use that, otherwise, use the source node
   nsCOMPtr<nsIDOMNode> dragNode = mImage ? mImage.get() : aDOMNode;
 
   // get the presshell for the node being dragged. If the drag image is not in
   // a document or has no frame, get the presshell from the source drag node
   nsIPresShell* presShell = GetPresShellForContent(dragNode);
   if (!presShell && mImage)
@@ -576,30 +576,31 @@ nsBaseDragService::DrawDrag(nsIDOMNode* 
     }
   }
 
   // convert mouse position to dev pixels of the prescontext
   CSSIntPoint screenPosition(aScreenPosition);
   screenPosition.x -= mImageOffset.x;
   screenPosition.y -= mImageOffset.y;
   LayoutDeviceIntPoint screenPoint = ConvertToUnscaledDevPixels(*aPresContext, screenPosition);
-  aScreenDragRect->x = screenPoint.x;
-  aScreenDragRect->y = screenPoint.y;
+  aScreenDragRect->MoveTo(screenPoint.x, screenPoint.y);
 
   // check if drag images are disabled
   bool enableDragImages = Preferences::GetBool(DRAGIMAGES_PREF, true);
 
   // didn't want an image, so just set the screen rectangle to the frame size
   if (!enableDragImages || !mHasImage) {
     // if a region was specified, set the screen rectangle to the area that
     // the region occupies
     CSSIntRect dragRect;
     if (aRegion) {
       // the region's coordinates are relative to the root frame
-      aRegion->GetBoundingBox(&dragRect.x, &dragRect.y, &dragRect.width, &dragRect.height);
+      int32_t dragRectX, dragRectY, dragRectW, dragRectH;
+      aRegion->GetBoundingBox(&dragRectX, &dragRectY, &dragRectW, &dragRectH);
+      dragRect.SetRect(dragRectX, dragRectY, dragRectW, dragRectH);
 
       nsIFrame* rootFrame = presShell->GetRootFrame();
       CSSIntRect screenRect = rootFrame->GetScreenRect();
       dragRect.MoveBy(screenRect.TopLeft());
     }
     else {
       // otherwise, there was no region so just set the rectangle to
       // the size of the primary frame of the content.
@@ -608,17 +609,17 @@ nsBaseDragService::DrawDrag(nsIDOMNode* 
       if (frame) {
         dragRect = frame->GetScreenRect();
       }
     }
 
     nsIntRect dragRectDev =
       ToAppUnits(dragRect, nsPresContext::AppUnitsPerCSSPixel()).
       ToOutsidePixels((*aPresContext)->AppUnitsPerDevPixel());
-    aScreenDragRect->SizeTo(dragRectDev.width, dragRectDev.height);
+    aScreenDragRect->SizeTo(dragRectDev.Width(), dragRectDev.Height());
     return NS_OK;
   }
 
   // draw the image for selections
   if (mSelection) {
     LayoutDeviceIntPoint pnt(aScreenDragRect->TopLeft());
     *aSurface = presShell->RenderSelection(mSelection, pnt, aScreenDragRect,
         mImage ? 0 : nsIPresShell::RENDER_AUTO_SCALE);
@@ -693,18 +694,17 @@ nsBaseDragService::DrawDrag(nsIDOMNode* 
     LayoutDeviceIntPoint pnt(aScreenDragRect->TopLeft());
     *aSurface = presShell->RenderNode(dragNode, aRegion ? &clipRegion : nullptr,
                                       pnt, aScreenDragRect,
                                       renderFlags);
   }
 
   // If an image was specified, reset the position from the offset that was supplied.
   if (mImage) {
-    aScreenDragRect->x = screenPoint.x;
-    aScreenDragRect->y = screenPoint.y;
+    aScreenDragRect->MoveTo(screenPoint.x, screenPoint.y);
   }
 
   return NS_OK;
 }
 
 nsresult
 nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
                                     nsIImageLoadingContent* aImageLoader,
@@ -729,30 +729,29 @@ nsBaseDragService::DrawDragForImage(nsPr
     // use the size of the image as the size of the drag image
     int32_t imageWidth, imageHeight;
     rv = imgContainer->GetWidth(&imageWidth);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = imgContainer->GetHeight(&imageHeight);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    aScreenDragRect->width = aPresContext->CSSPixelsToDevPixels(imageWidth);
-    aScreenDragRect->height = aPresContext->CSSPixelsToDevPixels(imageHeight);
+    aScreenDragRect->SizeTo(aPresContext->CSSPixelsToDevPixels(imageWidth),
+                            aPresContext->CSSPixelsToDevPixels(imageHeight));
   }
   else {
     // XXX The canvas size should be converted to dev pixels.
     NS_ASSERTION(aCanvas, "both image and canvas are null");
     nsIntSize sz = aCanvas->GetSize();
-    aScreenDragRect->width = sz.width;
-    aScreenDragRect->height = sz.height;
+    aScreenDragRect->SizeTo(sz.width, sz.height);
   }
 
   nsIntSize destSize;
-  destSize.width = aScreenDragRect->width;
-  destSize.height = aScreenDragRect->height;
+  destSize.width = aScreenDragRect->Width();
+  destSize.height = aScreenDragRect->Height();
   if (destSize.width == 0 || destSize.height == 0)
     return NS_ERROR_FAILURE;
 
   nsresult result = NS_OK;
   if (aImageLoader) {
     RefPtr<DrawTarget> dt =
       gfxPlatform::GetPlatform()->
         CreateOffscreenContentDrawTarget(destSize,
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -743,17 +743,17 @@ nsBaseWidget::StoreWindowClipRegion(cons
 }
 
 void
 nsBaseWidget::GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects)
 {
   if (mClipRects) {
     aRects->AppendElements(mClipRects.get(), mClipRectCount);
   } else {
-    aRects->AppendElement(LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height));
+    aRects->AppendElement(LayoutDeviceIntRect(0, 0, mBounds.Width(), mBounds.Height()));
   }
 }
 
 const LayoutDeviceIntRegion
 nsBaseWidget::RegionFromArray(const nsTArray<LayoutDeviceIntRect>& aRects)
 {
   LayoutDeviceIntRegion region;
   for (uint32_t i = 0; i < aRects.Length(); ++i) {
@@ -832,20 +832,21 @@ nsBaseWidget::InfallibleMakeFullScreen(b
       int32_t left, top, width, height;
       if (NS_SUCCEEDED(screen->GetRectDisplayPix(&left, &top, &width, &height))) {
         Resize(left, top, width, height, true);
       }
     }
   } else if (mOriginalBounds) {
     if (BoundsUseDesktopPixels()) {
       DesktopRect deskRect = *mOriginalBounds / GetDesktopToDeviceScale();
-      Resize(deskRect.x, deskRect.y, deskRect.width, deskRect.height, true);
+      Resize(deskRect.X(), deskRect.Y(),
+	     deskRect.Width(), deskRect.Height(), true);
     } else {
-      Resize(mOriginalBounds->x, mOriginalBounds->y, mOriginalBounds->width,
-             mOriginalBounds->height, true);
+      Resize(mOriginalBounds->X(), mOriginalBounds->Y(),
+	     mOriginalBounds->Width(), mOriginalBounds->Height(), true);
     }
   }
 }
 
 nsresult
 nsBaseWidget::MakeFullScreen(bool aFullScreen, nsIScreen* aScreen)
 {
   InfallibleMakeFullScreen(aFullScreen, aScreen);
@@ -897,17 +898,17 @@ nsBaseWidget::UseAPZ()
            WindowType() == eWindowType_child ||
            (WindowType() == eWindowType_popup && HasRemoteContent() &&
             gfxPrefs::APZPopupsEnabled())));
 }
 
 void nsBaseWidget::CreateCompositor()
 {
   LayoutDeviceIntRect rect = GetBounds();
-  CreateCompositor(rect.width, rect.height);
+  CreateCompositor(rect.Width(), rect.Height());
 }
 
 already_AddRefed<GeckoContentController>
 nsBaseWidget::CreateRootContentController()
 {
   RefPtr<GeckoContentController> controller = new ChromeProcessController(this, mAPZEventState, mAPZC);
   return controller.forget();
 }
@@ -1529,23 +1530,23 @@ nsBaseWidget::ResizeClient(double aWidth
   NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
 
   LayoutDeviceIntRect clientBounds = GetClientBounds();
 
   // GetClientBounds and mBounds are device pixels; scale back to desktop pixels
   // if that's what this widget uses for the Move/Resize APIs
   if (BoundsUseDesktopPixels()) {
     DesktopSize desktopDelta =
-      (LayoutDeviceIntSize(mBounds.width, mBounds.height) -
+      (LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()) -
        clientBounds.Size()) / GetDesktopToDeviceScale();
     Resize(aWidth + desktopDelta.width, aHeight + desktopDelta.height,
            aRepaint);
   } else {
-    Resize(mBounds.width + (aWidth - clientBounds.width),
-           mBounds.height + (aHeight - clientBounds.height), aRepaint);
+    Resize(mBounds.Width() + (aWidth - clientBounds.Width()),
+           mBounds.Height() + (aHeight - clientBounds.Height()), aRepaint);
   }
 }
 
 void
 nsBaseWidget::ResizeClient(double aX,
                            double aY,
                            double aWidth,
                            double aHeight,
@@ -1556,25 +1557,25 @@ nsBaseWidget::ResizeClient(double aX,
 
   LayoutDeviceIntRect clientBounds = GetClientBounds();
   LayoutDeviceIntPoint clientOffset = GetClientOffset();
 
   if (BoundsUseDesktopPixels()) {
     DesktopToLayoutDeviceScale scale = GetDesktopToDeviceScale();
     DesktopPoint desktopOffset = clientOffset / scale;
     DesktopSize desktopDelta =
-      (LayoutDeviceIntSize(mBounds.width, mBounds.height) -
+      (LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()) -
        clientBounds.Size()) / scale;
     Resize(aX - desktopOffset.x, aY - desktopOffset.y,
            aWidth + desktopDelta.width, aHeight + desktopDelta.height,
            aRepaint);
   } else {
     Resize(aX - clientOffset.x, aY - clientOffset.y,
-           aWidth + mBounds.width - clientBounds.width,
-           aHeight + mBounds.height - clientBounds.height,
+           aWidth + mBounds.Width() - clientBounds.Width(),
+           aHeight + mBounds.Height() - clientBounds.Height(),
            aRepaint);
   }
 }
 
 //-------------------------------------------------------------------------
 //
 // Bounds
 //
@@ -1969,18 +1970,18 @@ nsBaseWidget::GetWidgetScreen()
   screenManager = do_GetService("@mozilla.org/gfx/screenmanager;1");
   if (!screenManager) {
     return nullptr;
   }
 
   LayoutDeviceIntRect bounds = GetScreenBounds();
   DesktopIntRect deskBounds = RoundedToInt(bounds / GetDesktopToDeviceScale());
   nsCOMPtr<nsIScreen> screen;
-  screenManager->ScreenForRect(deskBounds.x, deskBounds.y,
-                               deskBounds.width, deskBounds.height,
+  screenManager->ScreenForRect(deskBounds.X(), deskBounds.Y(),
+                               deskBounds.Width(), deskBounds.Height(),
                                getter_AddRefs(screen));
   return screen.forget();
 }
 
 nsresult
 nsIWidget::SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint, bool aLongTap,
                                     nsIObserver* aObserver)
 {
@@ -2317,17 +2318,17 @@ nsBaseWidget::CreateScrollCaptureContain
 
   return mScrollCaptureContainer->GetAsyncContainerHandle().Value();
 }
 
 void
 nsBaseWidget::UpdateScrollCapture()
 {
   // Don't capture if no container or no size.
-  if (!mScrollCaptureContainer || mBounds.width <= 0 || mBounds.height <= 0) {
+  if (!mScrollCaptureContainer || mBounds.IsEmpty()) {
     return;
   }
 
   // If the derived class cannot take a snapshot, for example due to clipping,
   // then it is responsible for creating a fallback. If null is returned, this
   // means that we want to keep the existing snapshot.
   RefPtr<gfx::SourceSurface> snapshot = CreateScrollSnapshot();
   if (!snapshot) {
@@ -3374,17 +3375,17 @@ nsBaseWidget::debug_DumpPaintEvent(FILE 
 
   nsIntRect rect = aRegion.GetBounds();
   fprintf(aFileOut,
           "%4d PAINT      widget=%p name=%-12s id=0x%-6x bounds-rect=%3d,%-3d %3d,%-3d",
           _GetPrintCount(),
           (void *) aWidget,
           aWidgetName,
           aWindowID,
-          rect.x, rect.y, rect.width, rect.height
+          rect.X(), rect.Y(), rect.Width(), rect.Height()
     );
 
   fprintf(aFileOut,"\n");
 }
 //////////////////////////////////////////////////////////////
 /* static */ void
 nsBaseWidget::debug_DumpInvalidate(FILE* aFileOut,
                                    nsIWidget* aWidget,
@@ -3403,17 +3404,17 @@ nsBaseWidget::debug_DumpInvalidate(FILE*
           _GetPrintCount(),
           (void *) aWidget,
           aWidgetName,
           aWindowID);
 
   if (aRect) {
     fprintf(aFileOut,
             " rect=%3d,%-3d %3d,%-3d",
-            aRect->x, aRect->y, aRect->width, aRect->height);
+            aRect->X(), aRect->Y(), aRect->Width(), aRect->Height());
   } else {
     fprintf(aFileOut,
             " rect=%-15s",
             "none");
   }
 
   fprintf(aFileOut, "\n");
 }
--- a/widget/nsNativeTheme.cpp
+++ b/widget/nsNativeTheme.cpp
@@ -477,17 +477,17 @@ nsNativeTheme::IsLastTreeHeaderCell(nsIF
   // If the column picker is visible, this can't be the last column.
   if (parent && !parent->AsElement()->AttrValueIs(kNameSpaceID_None,
                                                   nsGkAtoms::hidecolumnpicker,
                                                   NS_LITERAL_STRING("true"),
                                                   eCaseMatters))
     return false;
 
   while ((aFrame = aFrame->GetNextSibling())) {
-    if (aFrame->GetRect().width > 0)
+    if (aFrame->GetRect().Width() > 0)
       return false;
   }
   return true;
 }
 
 // tab:
 bool
 nsNativeTheme::IsBottomTab(nsIFrame* aFrame)
@@ -507,17 +507,17 @@ nsNativeTheme::IsBottomTab(nsIFrame* aFr
 
 bool
 nsNativeTheme::IsFirstTab(nsIFrame* aFrame)
 {
   if (!aFrame)
     return false;
 
   for (nsIFrame* first : aFrame->GetParent()->PrincipalChildList()) {
-    if (first->GetRect().width > 0 &&
+    if (first->GetRect().Width() > 0 &&
         first->GetContent()->IsXULElement(nsGkAtoms::tab))
       return (first == aFrame);
   }
   return false;
 }
 
 bool
 nsNativeTheme::IsHorizontal(nsIFrame* aFrame)
@@ -542,17 +542,17 @@ nsNativeTheme::IsNextToSelectedTab(nsIFr
 
   if (aOffset == 0)
     return IsSelectedTab(aFrame);
 
   int32_t thisTabIndex = -1, selectedTabIndex = -1;
 
   nsIFrame* currentTab = aFrame->GetParent()->PrincipalChildList().FirstChild();
   for (int32_t i = 0; currentTab; currentTab = currentTab->GetNextSibling()) {
-    if (currentTab->GetRect().width == 0)
+    if (currentTab->GetRect().Width() == 0)
       continue;
     if (aFrame == currentTab)
       thisTabIndex = i;
     if (IsSelectedTab(currentTab))
       selectedTabIndex = i;
     ++i;
   }
 
@@ -620,17 +620,17 @@ nsNativeTheme::IsSubmenu(nsIFrame* aFram
 
   nsIFrame* parent = aFrame;
   while ((parent = parent->GetParent())) {
     if (parent->GetContent() == parentContent) {
       if (aLeftOfParent) {
         LayoutDeviceIntRect selfBounds, parentBounds;
         selfBounds = aFrame->GetNearestWidget()->GetScreenBounds();
         parentBounds = parent->GetNearestWidget()->GetScreenBounds();
-        *aLeftOfParent = selfBounds.x < parentBounds.x;
+        *aLeftOfParent = selfBounds.X() < parentBounds.X();
       }
       return true;
     }
   }
 
   return false;
 }
 
@@ -728,23 +728,23 @@ nsNativeTheme::GetAdjacentSiblingFrameWi
 {
   if (!aFrame)
     return nullptr;
 
   // Find the next visible sibling.
   nsIFrame* sibling = aFrame;
   do {
     sibling = aNextSibling ? sibling->GetNextSibling() : sibling->GetPrevSibling();
-  } while (sibling && sibling->GetRect().width == 0);
+  } while (sibling && sibling->GetRect().Width() == 0);
 
   // Check same appearance and adjacency.
   if (!sibling ||
       sibling->StyleDisplay()->mAppearance != aFrame->StyleDisplay()->mAppearance ||
-      (sibling->GetRect().XMost() != aFrame->GetRect().x &&
-       aFrame->GetRect().XMost() != sibling->GetRect().x))
+      (sibling->GetRect().XMost() != aFrame->GetRect().X() &&
+       aFrame->GetRect().XMost() != sibling->GetRect().X()))
     return nullptr;
   return sibling;
 }
 
 bool
 nsNativeTheme::IsRangeHorizontal(nsIFrame* aFrame)
 {
   nsIFrame* rangeFrame = aFrame;
--- a/widget/windows/IMMHandler.cpp
+++ b/widget/windows/IMMHandler.cpp
@@ -1731,36 +1731,36 @@ IMMHandler::HandleQueryCharPosition(nsWi
                      r, nullptr, screenRect);
 
   // XXX This might need to check writing mode.  However, MSDN doesn't explain
   //     how to set the values in vertical writing mode. Additionally, IME
   //     doesn't work well with top-left of the character (this is explicitly
   //     documented) and its horizontal width.  So, it might be better to set
   //     top-right corner of the character and horizontal width, but we're not
   //     sure if it doesn't cause any problems with a lot of IMEs...
-  pCharPosition->pt.x = screenRect.x;
-  pCharPosition->pt.y = screenRect.y;
+  pCharPosition->pt.x = screenRect.X();
+  pCharPosition->pt.y = screenRect.Y();
 
-  pCharPosition->cLineHeight = r.height;
+  pCharPosition->cLineHeight = r.Height();
 
   WidgetQueryContentEvent editorRect(true, eQueryEditorRect, aWindow);
   aWindow->InitEvent(editorRect);
   DispatchEvent(aWindow, editorRect);
   if (NS_WARN_IF(!editorRect.mSucceeded)) {
     MOZ_LOG(gIMMLog, LogLevel::Error,
       ("HandleQueryCharPosition, eQueryEditorRect failed"));
     ::GetWindowRect(aWindow->GetWindowHandle(), &pCharPosition->rcDocument);
   } else {
     LayoutDeviceIntRect editorRectInWindow = editorRect.mReply.mRect;
     nsWindow* window = editorRect.mReply.mFocusedWidget ?
       static_cast<nsWindow*>(editorRect.mReply.mFocusedWidget) : aWindow;
     LayoutDeviceIntRect editorRectInScreen;
     ResolveIMECaretPos(window, editorRectInWindow, nullptr, editorRectInScreen);
     ::SetRect(&pCharPosition->rcDocument,
-              editorRectInScreen.x, editorRectInScreen.y,
+              editorRectInScreen.X(), editorRectInScreen.Y(),
               editorRectInScreen.XMost(), editorRectInScreen.YMost());
   }
 
   *oResult = TRUE;
 
   MOZ_LOG(gIMMLog, LogLevel::Info,
     ("HandleQueryCharPosition, SUCCEEDED, pCharPosition={ pt={ x=%d, "
      "y=%d }, cLineHeight=%d, rcDocument={ left=%d, top=%d, right=%d, "
@@ -2259,17 +2259,17 @@ IMMHandler::GetCharacterRectOfSelectedTe
       aCharRect = charRect.mReply.mRect;
       if (aWritingMode) {
         *aWritingMode = charRect.GetWritingMode();
       }
       MOZ_LOG(gIMMLog, LogLevel::Debug,
         ("GetCharacterRectOfSelectedTextAt, Succeeded, aOffset=%u, "
          "aCharRect={ x: %ld, y: %ld, width: %ld, height: %ld }, "
          "charRect.GetWritingMode()=%s",
-         aOffset, aCharRect.x, aCharRect.y, aCharRect.width, aCharRect.height,
+         aOffset, aCharRect.X(), aCharRect.Y(), aCharRect.Width(), aCharRect.Height(),
          GetWritingModeName(charRect.GetWritingMode()).get()));
       return true;
     }
   }
 
   return GetCaretRect(aWindow, aCharRect, aWritingMode);
 }
 
@@ -2294,17 +2294,17 @@ IMMHandler::GetCaretRect(nsWindow* aWind
   aCaretRect = caretRect.mReply.mRect;
   if (aWritingMode) {
     *aWritingMode = caretRect.GetWritingMode();
   }
   MOZ_LOG(gIMMLog, LogLevel::Info,
     ("GetCaretRect, SUCCEEDED, "
      "aCaretRect={ x: %ld, y: %ld, width: %ld, height: %ld }, "
      "caretRect.GetWritingMode()=%s",
-     aCaretRect.x, aCaretRect.y, aCaretRect.width, aCaretRect.height,
+     aCaretRect.X(), aCaretRect.Y(), aCaretRect.Width(), aCaretRect.Height(),
      GetWritingModeName(caretRect.GetWritingMode()).get()));
   return true;
 }
 
 bool
 IMMHandler::SetIMERelatedWindowsPos(nsWindow* aWindow,
                                     const IMEContext& aContext)
 {
@@ -2321,27 +2321,27 @@ IMMHandler::SetIMERelatedWindowsPos(nsWi
   // Set native caret size/position to our caret. Some IMEs honor it. E.g.,
   // "Intelligent ABC" (Simplified Chinese) and "MS PinYin 3.0" (Simplified
   // Chinese) on XP.
   LayoutDeviceIntRect caretRect(firstSelectedCharRect);
   if (GetCaretRect(aWindow, r)) {
     ResolveIMECaretPos(toplevelWindow, r, aWindow, caretRect);
   } else {
     NS_WARNING("failed to get caret rect");
-    caretRect.width = 1;
+    caretRect.SetWidth(1);
   }
   if (!mNativeCaretIsCreated) {
     mNativeCaretIsCreated = ::CreateCaret(aWindow->GetWindowHandle(), nullptr,
-                                          caretRect.width, caretRect.height);
+                                          caretRect.Width(), caretRect.Height());
     MOZ_LOG(gIMMLog, LogLevel::Info,
       ("SetIMERelatedWindowsPos, mNativeCaretIsCreated=%s, "
        "width=%ld, height=%ld",
-       GetBoolName(mNativeCaretIsCreated), caretRect.width, caretRect.height));
+       GetBoolName(mNativeCaretIsCreated), caretRect.Width(), caretRect.Height()));
   }
-  ::SetCaretPos(caretRect.x, caretRect.y);
+  ::SetCaretPos(caretRect.X(), caretRect.Y());
 
   if (ShouldDrawCompositionStringOurselves()) {
     MOZ_LOG(gIMMLog, LogLevel::Info,
       ("SetIMERelatedWindowsPos, Set candidate window"));
 
     // Get a rect of first character in current target in composition string.
     LayoutDeviceIntRect firstTargetCharRect, lastTargetCharRect;
     if (mIsComposing && !mCompositionString.IsEmpty()) {
@@ -2383,48 +2383,48 @@ IMMHandler::SetIMERelatedWindowsPos(nsWi
     // Move the candidate window to proper position from the target clause as
     // far as possible.
     CANDIDATEFORM candForm;
     candForm.dwIndex = 0;
     if (!writingMode.IsVertical() || IsVerticalWritingSupported()) {
       candForm.dwStyle = CFS_EXCLUDE;
       // Candidate window shouldn't overlap the target clause in any writing
       // mode.
-      candForm.rcArea.left = targetClauseRect.x;
+      candForm.rcArea.left = targetClauseRect.X();
       candForm.rcArea.right = targetClauseRect.XMost();
-      candForm.rcArea.top = targetClauseRect.y;
+      candForm.rcArea.top = targetClauseRect.Y();
       candForm.rcArea.bottom = targetClauseRect.YMost();
       if (!writingMode.IsVertical()) {
         // In horizontal layout, current point of interest should be top-left
         // of the first character.
-        candForm.ptCurrentPos.x = firstTargetCharRect.x;
-        candForm.ptCurrentPos.y = firstTargetCharRect.y;
+        candForm.ptCurrentPos.x = firstTargetCharRect.X();
+        candForm.ptCurrentPos.y = firstTargetCharRect.Y();
       } else if (writingMode.IsVerticalRL()) {
         // In vertical layout (RL), candidate window should be positioned right
         // side of target clause.  However, we don't set vertical writing font
         // to the IME.  Therefore, the candidate window may be positioned
         // bottom-left of target clause rect with these information.
-        candForm.ptCurrentPos.x = targetClauseRect.x;
-        candForm.ptCurrentPos.y = targetClauseRect.y;
+        candForm.ptCurrentPos.x = targetClauseRect.X();
+        candForm.ptCurrentPos.y = targetClauseRect.Y();
       } else {
         MOZ_ASSERT(writingMode.IsVerticalLR(), "Did we miss some causes?");
         // In vertical layout (LR), candidate window should be poisitioned left
         // side of target clause.  Although, we don't set vertical writing font
         // to the IME, the candidate window may be positioned bottom-right of
         // the target clause rect with these information.
         candForm.ptCurrentPos.x = targetClauseRect.XMost();
-        candForm.ptCurrentPos.y = targetClauseRect.y;
+        candForm.ptCurrentPos.y = targetClauseRect.Y();
       }
     } else {
       // If vertical writing is not supported by IME, let's set candidate
       // window position to the bottom-left of the target clause because
       // the position must be the safest position to prevent the candidate
       // window to overlap with the target clause.
       candForm.dwStyle = CFS_CANDIDATEPOS;
-      candForm.ptCurrentPos.x = targetClauseRect.x;
+      candForm.ptCurrentPos.x = targetClauseRect.X();
       candForm.ptCurrentPos.y = targetClauseRect.YMost();
     }
     MOZ_LOG(gIMMLog, LogLevel::Info,
       ("SetIMERelatedWindowsPos, Calling ImmSetCandidateWindow()... "
        "ptCurrentPos={ x=%d, y=%d }, "
        "rcArea={ left=%d, top=%d, right=%d, bottom=%d }, "
        "writingMode=%s",
        candForm.ptCurrentPos.x, candForm.ptCurrentPos.y,
@@ -2438,19 +2438,19 @@ IMMHandler::SetIMERelatedWindowsPos(nsWi
 
     // Move the composition window to caret position (if selected some
     // characters, we should use first character rect of them).
     // And in this mode, IME adjusts the candidate window position
     // automatically. So, we don't need to set it.
     COMPOSITIONFORM compForm;
     compForm.dwStyle = CFS_POINT;
     compForm.ptCurrentPos.x =
-      !writingMode.IsVerticalLR() ? firstSelectedCharRect.x :
+      !writingMode.IsVerticalLR() ? firstSelectedCharRect.X() :
                                     firstSelectedCharRect.XMost();
-    compForm.ptCurrentPos.y = firstSelectedCharRect.y;
+    compForm.ptCurrentPos.y = firstSelectedCharRect.Y();
     ::ImmSetCompositionWindow(aContext.get(), &compForm);
   }
 
   return true;
 }
 
 void
 IMMHandler::SetIMERelatedWindowsPosOnPlugin(nsWindow* aWindow,
@@ -2468,40 +2468,39 @@ IMMHandler::SetIMERelatedWindowsPosOnPlu
 
   // 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();
   LayoutDeviceIntRect winRectInScreen = aWindow->GetClientBounds();
   // composition window cannot be positioned on the edge of client area.
-  winRectInScreen.width--;
-  winRectInScreen.height--;
+  winRectInScreen.SizeTo(winRectInScreen.Width() - 1,
+                         winRectInScreen.Height() - 1);
   LayoutDeviceIntRect clippedPluginRect;
-  clippedPluginRect.x =
-    std::min(std::max(pluginRectInScreen.x, winRectInScreen.x),
-             winRectInScreen.XMost());
-  clippedPluginRect.y =
-    std::min(std::max(pluginRectInScreen.y, winRectInScreen.y),
-             winRectInScreen.YMost());
+  clippedPluginRect.MoveTo(
+    std::min(std::max(pluginRectInScreen.X(), winRectInScreen.X()),
+             winRectInScreen.XMost()),
+    std::min(std::max(pluginRectInScreen.Y(), winRectInScreen.Y()),
+             winRectInScreen.YMost()));
   int32_t xMost = std::min(pluginRectInScreen.XMost(), winRectInScreen.XMost());
   int32_t yMost = std::min(pluginRectInScreen.YMost(), winRectInScreen.YMost());
-  clippedPluginRect.width = std::max(0, xMost - clippedPluginRect.x);
-  clippedPluginRect.height = std::max(0, yMost - clippedPluginRect.y);
+  clippedPluginRect.SizeTo(std::max(0, xMost - clippedPluginRect.X()),
+                           std::max(0, yMost - clippedPluginRect.Y()));
   clippedPluginRect -= aWindow->WidgetToScreenOffset();
 
   // Cover the plugin with native caret.  This prevents IME's window and plugin
   // overlap.
   if (mNativeCaretIsCreated) {
     ::DestroyCaret();
   }
   mNativeCaretIsCreated =
     ::CreateCaret(aWindow->GetWindowHandle(), nullptr,
-                  clippedPluginRect.width, clippedPluginRect.height);
-  ::SetCaretPos(clippedPluginRect.x, clippedPluginRect.y);
+                  clippedPluginRect.Width(), clippedPluginRect.Height());
+  ::SetCaretPos(clippedPluginRect.X(), clippedPluginRect.Y());
 
   // Set the composition window to bottom-left of the clipped plugin.
   // As far as we know, there is no IME for RTL language.  Therefore, this code
   // must not need to take care of RTL environment.
   COMPOSITIONFORM compForm;
   compForm.dwStyle = CFS_POINT;
   compForm.ptCurrentPos.x = clippedPluginRect.BottomLeft().x;
   compForm.ptCurrentPos.y = clippedPluginRect.BottomLeft().y;
@@ -2716,27 +2715,27 @@ IMMHandler::OnMouseButtonEvent(nsWindow*
   // calcurate positioning and offset
   // char :            JCH1|JCH2|JCH3
   // offset:           0011 1122 2233
   // positioning:      2301 2301 2301
   nsIntPoint cursorPos =
     aIMENotification.mMouseButtonEventData.mCursorPos.AsIntPoint();
   nsIntRect charRect =
     aIMENotification.mMouseButtonEventData.mCharRect.AsIntRect();
-  int32_t cursorXInChar = cursorPos.x - charRect.x;
+  int32_t cursorXInChar = cursorPos.x - charRect.X();
   // The event might hit to zero-width character, see bug 694913.
   // The reason might be:
   // * There are some zero-width characters are actually.
   // * font-size is specified zero.
   // But nobody reproduced this bug actually...
   // We should assume that user clicked on right most of the zero-width
   // character in such case.
   int positioning = 1;
-  if (charRect.width > 0) {
-    positioning = cursorXInChar * 4 / charRect.width;
+  if (charRect.Width() > 0) {
+    positioning = cursorXInChar * 4 / charRect.Width();
     positioning = (positioning + 2) % 4;
   }
 
   int offset =
     aIMENotification.mMouseButtonEventData.mOffset - compositionStart;
   if (positioning < 2) {
     offset++;
   }
--- a/widget/windows/ScreenHelperWin.cpp
+++ b/widget/windows/ScreenHelperWin.cpp
@@ -46,18 +46,18 @@ CollectMonitors(HMONITOR aMon, HDC hDCSc
     // If a device uses 32 bits per pixel, it's still only using 8 bits
     // per color component, which is what our callers want to know.
     // (Some devices report 32 and some devices report 24.)
     pixelDepth = 24;
   }
   float dpi = WinUtils::MonitorDPI(aMon);
   MOZ_LOG(sScreenLog, LogLevel::Debug,
            ("New screen [%d %d %d %d (%d %d %d %d) %d %f %f %f]",
-            rect.x, rect.y, rect.width, rect.height,
-            availRect.x, availRect.y, availRect.width, availRect.height,
+            rect.X(), rect.Y(), rect.Width(), rect.Height(),
+            availRect.X(), availRect.Y(), availRect.Width(), availRect.Height(),
             pixelDepth, contentsScaleFactor.scale, defaultCssScaleFactor.scale,
             dpi));
   auto screen = new Screen(rect, availRect,
                            pixelDepth, pixelDepth,
                            contentsScaleFactor, defaultCssScaleFactor,
                            dpi);
   if (info.dwFlags & MONITORINFOF_PRIMARY) {
     // The primary monitor must be the first element of the screen list.
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -4475,20 +4475,20 @@ TSFTextStore::GetTextExt(TsViewCookie vc
   if (NS_WARN_IF(!event.mSucceeded)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
       ("0x%p   TSFTextStore::GetTextExt() FAILED due to "
        "eQueryTextRect failure", this));
     return TS_E_INVALIDPOS; // but unexpected failure, maybe.
   }
 
   // IMEs don't like empty rects, fix here
-  if (event.mReply.mRect.width <= 0)
-    event.mReply.mRect.width = 1;
-  if (event.mReply.mRect.height <= 0)
-    event.mReply.mRect.height = 1;
+  if (event.mReply.mRect.Width() <= 0)
+    event.mReply.mRect.SetWidth(1);
+  if (event.mReply.mRect.Height() <= 0)
+    event.mReply.mRect.SetHeight(1);
 
   // convert to unclipped screen rect
   nsWindow* refWindow = static_cast<nsWindow*>(
     event.mReply.mFocusedWidget ? event.mReply.mFocusedWidget : mWidget);
   // Result rect is in top level widget coordinates
   refWindow = refWindow->GetTopLevelWindow(false);
   if (!refWindow) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
@@ -4504,17 +4504,17 @@ TSFTextStore::GetTextExt(TsViewCookie vc
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
       ("0x%p   TSFTextStore::GetTextExt() FAILED due to "
        "GetScreenExtInternal() failure", this));
     return E_FAIL;
   }
 
   // clip text rect to bounding rect
   RECT textRect;
-  ::SetRect(&textRect, event.mReply.mRect.x, event.mReply.mRect.y,
+  ::SetRect(&textRect, event.mReply.mRect.X(), event.mReply.mRect.Y(),
             event.mReply.mRect.XMost(), event.mReply.mRect.YMost());
   if (!::IntersectRect(prc, prc, &textRect))
     // Text is not visible
     ::SetRectEmpty(prc);
 
   // not equal if text rect was clipped
   *pfClipped = !::EqualRect(prc, &textRect);
 
@@ -4616,17 +4616,17 @@ TSFTextStore::GetScreenExtInternal(RECT&
 
   LayoutDeviceIntRect boundRect = refWindow->GetClientBounds();
   boundRect.MoveTo(0, 0);
 
   // Clip frame rect to window rect
   boundRect.IntersectRect(event.mReply.mRect, boundRect);
   if (!boundRect.IsEmpty()) {
     boundRect.MoveBy(refWindow->WidgetToScreenOffset());
-    ::SetRect(&aScreenExt, boundRect.x, boundRect.y,
+    ::SetRect(&aScreenExt, boundRect.X(), boundRect.Y(),
               boundRect.XMost(), boundRect.YMost());
   } else {
     ::SetRectEmpty(&aScreenExt);
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
     ("0x%p   TSFTextStore::GetScreenExtInternal() succeeded: "
      "aScreenExt={ left=%ld, top=%ld, right=%ld, bottom=%ld }",
@@ -5936,19 +5936,19 @@ TSFTextStore::OnMouseButtonEventInternal
        aIMENotification.mMouseButtonEventData.mModifiers).get()));
 
   uint32_t offset = aIMENotification.mMouseButtonEventData.mOffset;
   nsIntRect charRect =
     aIMENotification.mMouseButtonEventData.mCharRect.AsIntRect();
   nsIntPoint cursorPos =
     aIMENotification.mMouseButtonEventData.mCursorPos.AsIntPoint();
   ULONG quadrant = 1;
-  if (charRect.width > 0) {
-    int32_t cursorXInChar = cursorPos.x - charRect.x;
-    quadrant = cursorXInChar * 4 / charRect.width;
+  if (charRect.Width() > 0) {
+    int32_t cursorXInChar = cursorPos.x - charRect.X();
+    quadrant = cursorXInChar * 4 / charRect.Width();
     quadrant = (quadrant + 2) % 4;
   }
   ULONG edge = quadrant < 2 ? offset + 1 : offset;
   DWORD buttonStatus = 0;
   bool isMouseUp =
     aIMENotification.mMouseButtonEventData.mEventMessage == eMouseUp;
   if (!isMouseUp) {
     switch (aIMENotification.mMouseButtonEventData.mButton) {
@@ -6033,17 +6033,17 @@ TSFTextStore::CreateNativeCaret()
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
       ("0x%p   TSFTextStore::CreateNativeCaret() FAILED due to "
        "eQueryCaretRect failure (offset=%d)", this, caretOffset));
     return;
   }
 
   LayoutDeviceIntRect& caretRect = queryCaretRect.mReply.mRect;
   mNativeCaretIsCreated = ::CreateCaret(mWidget->GetWindowHandle(), nullptr,
-                                        caretRect.width, caretRect.height);
+                                        caretRect.Width(), caretRect.Height());
   if (!mNativeCaretIsCreated) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
       ("0x%p   TSFTextStore::CreateNativeCaret() FAILED due to "
        "CreateCaret() failure", this));
     return;
   }
 
   nsWindow* window = static_cast<nsWindow*>(mWidget.get());
@@ -6055,17 +6055,17 @@ TSFTextStore::CreateNativeCaret()
     return;
   }
 
   if (toplevelWindow != window) {
     caretRect.MoveBy(toplevelWindow->WidgetToScreenOffset());
     caretRect.MoveBy(-window->WidgetToScreenOffset());
   }
 
-  ::SetCaretPos(caretRect.x, caretRect.y);
+  ::SetCaretPos(caretRect.X(), caretRect.Y());
 }
 
 void
 TSFTextStore::MaybeDestroyNativeCaret()
 {
   if (!mNativeCaretIsCreated) {
     return;
   }
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -668,20 +668,20 @@ WinUtils::GetPrimaryMonitor()
 HMONITOR
 WinUtils::MonitorFromRect(const gfx::Rect& rect)
 {
   // convert coordinates from desktop to device pixels for MonitorFromRect
   double dpiScale =
     IsPerMonitorDPIAware() ? 1.0 : LogToPhysFactor(GetPrimaryMonitor());
 
   RECT globalWindowBounds = {
-    NSToIntRound(dpiScale * rect.x),
-    NSToIntRound(dpiScale * rect.y),
-    NSToIntRound(dpiScale * (rect.x + rect.width)),
-    NSToIntRound(dpiScale * (rect.y + rect.height))
+    NSToIntRound(dpiScale * rect.X()),
+    NSToIntRound(dpiScale * rect.Y()),
+    NSToIntRound(dpiScale * (rect.XMost())),
+    NSToIntRound(dpiScale * (rect.YMost()))
   };
 
   return ::MonitorFromRect(&globalWindowBounds, MONITOR_DEFAULTTONEAREST);
 }
 
 #ifdef ACCESSIBILITY
 #ifndef STATUS_SUCCESS
 #define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
@@ -1169,18 +1169,18 @@ WinUtils::InvalidatePluginAsWorkaround(n
     // This is relative to the screen, adjust it to be relative to the
     // window we're reconfiguring.
     windowRect.left -= parentRect.left;
     windowRect.top -= parentRect.top;
   } while (next != current && windowRect.top == 0 && windowRect.left == 0);
 
   if (windowRect.top == 0 && windowRect.left == 0) {
     RECT rect;
-    rect.left   = aRect.x;
-    rect.top    = aRect.y;
+    rect.left   = aRect.X();
+    rect.top    = aRect.Y();
     rect.right  = aRect.XMost();
     rect.bottom = aRect.YMost();
 
     ::InvalidateRect(next, &rect, FALSE);
   }
 }
 
 #ifdef MOZ_PLACES
--- a/widget/windows/nsDragService.cpp
+++ b/widget/windows/nsDragService.cpp
@@ -82,17 +82,17 @@ nsDragService::CreateDragImage(nsIDOMNod
   // Prepare the drag image
   LayoutDeviceIntRect dragRect;
   RefPtr<SourceSurface> surface;
   nsPresContext* pc;
   DrawDrag(aDOMNode, aRegion, mScreenPosition, &dragRect, &surface, &pc);
   if (!surface)
     return false;
 
-  uint32_t bmWidth = dragRect.width, bmHeight = dragRect.height;
+  uint32_t bmWidth = dragRect.Width(), bmHeight = dragRect.Height();
 
   if (bmWidth == 0 || bmHeight == 0)
     return false;
 
   psdi->crColorKey = CLR_NONE;
 
   RefPtr<DataSourceSurface> dataSurface =
     Factory::CreateDataSourceSurface(IntSize(bmWidth, bmHeight),
@@ -147,18 +147,18 @@ nsDragService::CreateDragImage(nsIDOMNod
                                    BytesPerPixel(dataSurface->GetFormat()));
     }
 
     psdi->sizeDragImage.cx = bmWidth;
     psdi->sizeDragImage.cy = bmHeight;
 
     LayoutDeviceIntPoint screenPoint =
       ConvertToUnscaledDevPixels(pc, mScreenPosition);
-    psdi->ptOffset.x = screenPoint.x - dragRect.x;
-    psdi->ptOffset.y = screenPoint.y - dragRect.y;
+    psdi->ptOffset.x = screenPoint.x - dragRect.X();
+    psdi->ptOffset.y = screenPoint.y - dragRect.Y();
 
     DeleteDC(hdcSrc);
   }
 
   dataSurface->Unmap();
 
   return psdi->hbmpDragImage != nullptr;
 }
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -1579,18 +1579,18 @@ nsNativeThemeWin::DrawWidgetBackground(g
   double themeScale = GetThemeDpiScaleFactor(aFrame);
   if (themeScale != 1.0) {
     ctx->SetMatrix(ctx->CurrentMatrix().PreScale(themeScale, themeScale));
   }
 
   gfxFloat p2a = gfxFloat(aFrame->PresContext()->AppUnitsPerDevPixel());
   RECT widgetRect;
   RECT clipRect;
-  gfxRect tr(aRect.x, aRect.y, aRect.width, aRect.height),
-          dr(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
+  gfxRect tr(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height()),
+          dr(aDirtyRect.X(), aDirtyRect.Y(), aDirtyRect.Width(), aDirtyRect.Height());
 
   tr.Scale(1.0 / (p2a * themeScale));
   dr.Scale(1.0 / (p2a * themeScale));
 
   gfxWindowsNativeDrawing nativeDrawing(ctx, dr, GetWidgetNativeDrawingFlags(aWidgetType));
 
 RENDER_AGAIN:
 
@@ -3546,18 +3546,18 @@ nsresult nsNativeThemeWin::ClassicDrawWi
     return rv;
 
   if (AssumeThemePartAndStateAreTransparent(part, state)) {
     return NS_OK;
   }
 
   gfxFloat p2a = gfxFloat(aFrame->PresContext()->AppUnitsPerDevPixel());
   RECT widgetRect;
-  gfxRect tr(aRect.x, aRect.y, aRect.width, aRect.height),
-          dr(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
+  gfxRect tr(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height()),
+          dr(aDirtyRect.X(), aDirtyRect.Y(), aDirtyRect.Width(), aDirtyRect.Height());
 
   tr.Scale(1.0 / p2a);
   dr.Scale(1.0 / p2a);
 
   RefPtr<gfxContext> ctx = aContext;
 
   gfxWindowsNativeDrawing nativeDrawing(ctx, dr, GetWidgetNativeDrawingFlags(aWidgetType));
 
--- a/widget/windows/nsPrintDialogUtil.cpp
+++ b/widget/windows/nsPrintDialogUtil.cpp
@@ -225,20 +225,20 @@ CreateControl(LPCWSTR aType,
               HWND aHdlg,
               int aId,
               LPCWSTR aStr,
               const nsIntRect& aRect)
 {
   HWND hWnd = ::CreateWindowW(aType,
                               aStr,
                               WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | aStyle,
-                              aRect.x,
-                              aRect.y,
-                              aRect.width,
-                              aRect.height,
+                              aRect.X(),
+                              aRect.Y(),
+                              aRect.Width(),
+                              aRect.Height(),
                               (HWND)aHdlg,
                               (HMENU)(intptr_t)aId,
                               aHInst,
                               nullptr);
   if (hWnd == nullptr)
     return nullptr;
 
   // get the native font for the dialog and
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -829,20 +829,20 @@ nsWindow::Create(nsIWidget* aParent,
       aInitData->mWindowType == eWindowType_plugin_ipc_chrome ||
       aInitData->mWindowType == eWindowType_plugin_ipc_content) {
     style |= WS_DISABLED;
   }
   mWnd = ::CreateWindowExW(extendedStyle,
                            className,
                            L"",
                            style,
-                           aRect.x,
-                           aRect.y,
-                           aRect.width,
-                           GetHeight(aRect.height),
+                           aRect.X(),
+                           aRect.Y(),
+                           aRect.Width(),
+                           GetHeight(aRect.Height()),
                            parent,
                            nullptr,
                            nsToolkit::mDllInstance,
                            nullptr);
 
   if (!mWnd) {
     NS_WARNING("nsWindow CreateWindowEx failed.");
     return NS_ERROR_FAILURE;
@@ -1430,38 +1430,38 @@ already_AddRefed<SourceSurface>
 nsWindow::CreateScrollSnapshot()
 {
   RECT clip = { 0 };
   int rgnType = ::GetWindowRgnBox(mWnd, &clip);
   if (rgnType == RGN_ERROR) {
     // We failed to get the clip assume that we need a full fallback.
     clip.left = 0;
     clip.top = 0;
-    clip.right = mBounds.width;
-    clip.bottom = mBounds.height;
+    clip.right = mBounds.Width();
+    clip.bottom = mBounds.Height();
     return GetFallbackScrollSnapshot(clip);
   }
 
   // Check that the window is in a position to snapshot. We don't check for
   // clipped width as that doesn't currently matter for APZ scrolling.
-  if (clip.top || clip.bottom != mBounds.height) {
+  if (clip.top || clip.bottom != mBounds.Height()) {
     return GetFallbackScrollSnapshot(clip);
   }
 
   HDC windowDC = ::GetDC(mWnd);
   if (!windowDC) {
     return GetFallbackScrollSnapshot(clip);
   }
   auto releaseDC = MakeScopeExit([&] {
     ::ReleaseDC(mWnd, windowDC);
   });
 
-  gfx::IntSize snapshotSize(mBounds.width, mBounds.height);
+  gfx::IntSize snapshotSize(mBounds.Width(), mBounds.Height());
   ScrollSnapshot* snapshot;
-  if (clip.left || clip.right != mBounds.width) {
+  if (clip.left || clip.right != mBounds.Width()) {
     // Can't do a full snapshot, so use the partial snapshot.
     snapshot = EnsureSnapshotSurface(mPartialSnapshot, snapshotSize);
   } else {
     snapshot = EnsureSnapshotSurface(mFullSnapshot, snapshotSize);
   }
 
   // Note that we know that the clip is full height.
   if (!::BitBlt(snapshot->surface->GetDC(), clip.left, 0, clip.right - clip.left,
@@ -1475,17 +1475,17 @@ nsWindow::CreateScrollSnapshot()
   mCurrentSnapshot = snapshot;
 
   return CreateSourceSurfaceForGfxSurface(mCurrentSnapshot->surface);
 }
 
 already_AddRefed<SourceSurface>
 nsWindow::GetFallbackScrollSnapshot(const RECT& aRequiredClip)
 {
-  gfx::IntSize snapshotSize(mBounds.width, mBounds.height);
+  gfx::IntSize snapshotSize(mBounds.Width(), mBounds.Height());
 
   // If the current snapshot is the correct size and covers the required clip,
   // just keep that by returning null.
   // Note: we know the clip is always full height.
   if (mCurrentSnapshot &&
       mCurrentSnapshot->surface->GetSize() == snapshotSize &&
       mCurrentSnapshot->clip.left <= aRequiredClip.left &&
       mCurrentSnapshot->clip.right >= aRequiredClip.right) {
@@ -1688,17 +1688,17 @@ void nsWindow::SetThemeRegion()
   // for other window types as needed. The regions are applied generically to the base window
   // so default constants are used for part and state. At some point we might need part and
   // state values from nsNativeThemeWin's GetThemePartAndState, but currently windows that
   // change shape based on state haven't come up.
   if (!HasGlass() &&
       (mWindowType == eWindowType_popup && !IsPopupWithTitleBar() &&
        (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) {
     HRGN hRgn = nullptr;
-    RECT rect = {0,0,mBounds.width,mBounds.height};
+    RECT rect = {0,0,mBounds.Width(),mBounds.Height()};
     
     HDC dc = ::GetDC(mWnd);
     GetThemeBackgroundRegion(nsUXThemeData::GetTheme(eUXTooltip), dc, TTP_STANDARD, TS_NORMAL, &rect, &hRgn);
     if (hRgn) {
       if (!SetWindowRgn(mWnd, hRgn, false)) // do not delete or alter hRgn if accepted.
         DeleteObject(hRgn);
     }
     ::ReleaseDC(mWnd, dc);
@@ -1799,24 +1799,23 @@ nsWindow::Move(double aX, double aY)
   // Check to see if window needs to be moved first
   // to avoid a costly call to SetWindowPos. This check
   // can not be moved to the calling code in nsView, because
   // some platforms do not position child windows correctly
 
   // Only perform this check for non-popup windows, since the positioning can
   // in fact change even when the x/y do not.  We always need to perform the
   // check. See bug #97805 for details.
-  if (mWindowType != eWindowType_popup && (mBounds.x == x) && (mBounds.y == y))
+  if (mWindowType != eWindowType_popup && mBounds.IsEqualXY(x, y))
   {
     // Nothing to do, since it is already positioned correctly.
     return;
   }
 
-  mBounds.x = x;
-  mBounds.y = y;
+  mBounds.MoveTo(x, y);
 
   if (mWnd) {
 #ifdef DEBUG
     // complain if a window is moved offscreen (legal, but potentially worrisome)
     if (mIsTopWidgetWindow) { // only a problem for top-level windows
       // Make sure this window is actually on the screen before we move it
       // XXX: Needs multiple monitor support
       HDC dc = ::GetDC(mWnd);
@@ -1838,17 +1837,17 @@ nsWindow::Move(double aX, double aY)
 
     UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE;
     // Workaround SetWindowPos bug with D3D9. If our window has a clip
     // region, some drivers or OSes may incorrectly copy into the clipped-out
     // area.
     if (IsPlugin() &&
         !mLayerManager &&
         mClipRects &&
-        (mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height)))) {
+        (mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(LayoutDeviceIntRect(0, 0, mBounds.Width(), mBounds.Height())))) {
       flags |= SWP_NOCOPYBITS;
     }
     double oldScale = mDefaultScale;
     mResizeState = IN_SIZEMOVE;
     VERIFY(::SetWindowPos(mWnd, nullptr, x, y, 0, 0, flags));
     mResizeState = NOT_RESIZING;
     if (WinUtils::LogToPhysFactor(mWnd) != oldScale) {
       ChangedDPI();
@@ -1870,26 +1869,25 @@ nsWindow::Resize(double aWidth, double a
   int32_t height = NSToIntRound(aHeight * scale);
 
   NS_ASSERTION((width >= 0) , "Negative width passed to nsWindow::Resize");
   NS_ASSERTION((height >= 0), "Negative height passed to nsWindow::Resize");
 
   ConstrainSize(&width, &height);
 
   // Avoid unnecessary resizing calls
-  if (mBounds.width == width && mBounds.height == height) {
+  if (mBounds.IsEqualSize(width, height)) {
     if (aRepaint) {
       Invalidate();
     }
     return;
   }
 
   // Set cached value for lightweight and printing
-  mBounds.width  = width;
-  mBounds.height = height;
+  mBounds.SizeTo(width, height);
 
   if (mWnd) {
     UINT  flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE;
 
     if (!aRepaint) {
       flags |= SWP_NOREDRAW;
     }
 
@@ -1923,29 +1921,25 @@ nsWindow::Resize(double aX, double aY, d
   int32_t height = NSToIntRound(aHeight * scale);
 
   NS_ASSERTION((width >= 0),  "Negative width passed to nsWindow::Resize");
   NS_ASSERTION((height >= 0), "Negative height passed to nsWindow::Resize");
 
   ConstrainSize(&width, &height);
 
   // Avoid unnecessary resizing calls
-  if (mBounds.x == x && mBounds.y == y &&
-      mBounds.width == width && mBounds.height == height) {
+  if (mBounds.IsEqualRect(x, y, width, height)) {
     if (aRepaint) {
       Invalidate();
     }
     return;
   }
 
   // Set cached value for lightweight and printing
-  mBounds.x      = x;
-  mBounds.y      = y;
-  mBounds.width  = width;
-  mBounds.height = height;
+  mBounds.SetRect(x, y, width, height);
 
   if (mWnd) {
     UINT  flags = SWP_NOZORDER | SWP_NOACTIVATE;
     if (!aRepaint) {
       flags |= SWP_NOREDRAW;
     }
 
     ClearThemeRegion();
@@ -2142,18 +2136,18 @@ nsWindow::ConstrainPosition(bool aAllowS
 {
   if (!mIsTopWidgetWindow) // only a problem for top-level windows
     return;
 
   double dpiScale = GetDesktopToDeviceScale().scale;
 
   // We need to use the window size in the kind of pixels used for window-
   // manipulation APIs.
-  int32_t logWidth = std::max<int32_t>(NSToIntRound(mBounds.width / dpiScale), 1);
-  int32_t logHeight = std::max<int32_t>(NSToIntRound(mBounds.height / dpiScale), 1);
+  int32_t logWidth = std::max<int32_t>(NSToIntRound(mBounds.Width() / dpiScale), 1);
+  int32_t logHeight = std::max<int32_t>(NSToIntRound(mBounds.Height() / dpiScale), 1);
 
   /* get our playing field. use the current screen, or failing that
   for any reason, use device caps for the default screen. */
   RECT screenRect;
 
   nsCOMPtr<nsIScreenManager> screenmgr = do_GetService(sScreenManagerContractID);
   if (!screenmgr) {
     return;
@@ -2287,24 +2281,22 @@ nsWindow::GetBounds()
   }
 
   RECT r;
   VERIFY(::GetWindowRect(mWnd, &r));
 
   LayoutDeviceIntRect rect;
 
   // assign size
-  rect.width  = r.right - r.left;
-  rect.height = r.bottom - r.top;
+  rect.SizeTo(r.right - r.left, r.bottom - r.top);
 
   // popup window bounds' are in screen coordinates, not relative to parent
   // window
   if (mWindowType == eWindowType_popup) {
-    rect.x = r.left;
-    rect.y = r.top;
+    rect.MoveTo(r.left, r.top);
     return rect;
   }
 
   // chrome on parent:
   //  ___      5,5   (chrome start)
   // |  ____   10,10 (client start)
   // | |  ____ 20,20 (child start)
   // | | |
@@ -2339,18 +2331,17 @@ nsWindow::GetBounds()
     // adjust for chrome
     nsWindow* pWidget = static_cast<nsWindow*>(GetParent());
     if (pWidget && pWidget->IsTopLevelWidget()) {
       LayoutDeviceIntPoint clientOffset = pWidget->GetClientOffset();
       r.left -= clientOffset.x;
       r.top  -= clientOffset.y;
     }
   }
-  rect.x = r.left;
-  rect.y = r.top;
+  rect.MoveTo(r.left, r.top);
   return rect;
 }
 
 // Get this component dimension
 LayoutDeviceIntRect
 nsWindow::GetClientBounds()
 {
   if (!mWnd) {
@@ -2358,38 +2349,32 @@ nsWindow::GetClientBounds()
   }
 
   RECT r;
   VERIFY(::GetClientRect(mWnd, &r));
 
   LayoutDeviceIntRect bounds = GetBounds();
   LayoutDeviceIntRect rect;
   rect.MoveTo(bounds.TopLeft() + GetClientOffset());
-  rect.width  = r.right - r.left;
-  rect.height = r.bottom - r.top;
+  rect.SizeTo(r.right - r.left, r.bottom - r.top);
   return rect;
 }
 
 // Like GetBounds, but don't offset by the parent
 LayoutDeviceIntRect
 nsWindow::GetScreenBounds()
 {
   if (!mWnd) {
     return mBounds;
   }
 
   RECT r;
   VERIFY(::GetWindowRect(mWnd, &r));
 
-  LayoutDeviceIntRect rect;
-  rect.x = r.left;
-  rect.y = r.top;
-  rect.width  = r.right - r.left;
-  rect.height = r.bottom - r.top;
-  return rect;
+  return LayoutDeviceIntRect(r.left, r.top, r.right - r.left, r.bottom - r.top);
 }
 
 nsresult
 nsWindow::GetRestoredBounds(LayoutDeviceIntRect &aRect)
 {
   if (SizeMode() == nsSizeMode_Normal) {
     aRect = GetScreenBounds();
     return NS_OK;
@@ -3089,26 +3074,26 @@ void nsWindow::UpdateOpaqueRegion(const 
     }
 
     LayoutDeviceIntRect clientBounds = GetClientBounds();
 
     // Find the largest rectangle and use that to calculate the inset. Our top
     // priority is to include the bounds of all plugins.
     LayoutDeviceIntRect largest =
       aOpaqueRegion.GetLargestRectangle(pluginBounds);
-    margins.cxLeftWidth = largest.x;
-    margins.cxRightWidth = clientBounds.width - largest.XMost();
-    margins.cyBottomHeight = clientBounds.height - largest.YMost();
+    margins.cxLeftWidth = largest.X();
+    margins.cxRightWidth = clientBounds.Width() - largest.XMost();
+    margins.cyBottomHeight = clientBounds.Height() - largest.YMost();
     if (mCustomNonClient) {
       // The minimum glass height must be the caption buttons height,
       // otherwise the buttons are drawn incorrectly.
-      largest.y = std::max<uint32_t>(largest.y,
-                         nsUXThemeData::GetCommandButtonBoxMetrics().cy);
-    }
-    margins.cyTopHeight = largest.y;
+      largest.MoveToY(std::max<uint32_t>(largest.Y(),
+                        nsUXThemeData::GetCommandButtonBoxMetrics().cy));
+    }
+    margins.cyTopHeight = largest.Y();
   }
 
   // Only update glass area if there are changes
   if (memcmp(&mGlassMargins, &margins, sizeof mGlassMargins)) {
     mGlassMargins = margins;
     UpdateGlass();
   }
 }
@@ -3271,20 +3256,20 @@ nsWindow::Invalidate(const LayoutDeviceI
                          this,
                          &aRect,
                          "noname",
                          (int32_t) mWnd);
 #endif // WIDGET_DEBUG_OUTPUT
 
     RECT rect;
 
-    rect.left   = aRect.x;
-    rect.top    = aRect.y;
-    rect.right  = aRect.x + aRect.width;
-    rect.bottom = aRect.y + aRect.height;
+    rect.left   = aRect.X();
+    rect.top    = aRect.Y();
+    rect.right  = aRect.XMost();
+    rect.bottom = aRect.YMost();
 
     VERIFY(::InvalidateRect(mWnd, &rect, FALSE));
   }
 }
 
 static LRESULT CALLBACK
 FullscreenTransitionWindowProc(HWND hWnd, UINT uMsg,
                                WPARAM wParam, LPARAM lParam)
@@ -3361,18 +3346,18 @@ FullscreenTransitionThreadProc(LPVOID lp
 
   // Since AnimateWindow blocks the thread of the transition window,
   // we need to hide the cursor for that window, otherwise the system
   // would show the busy pointer to the user.
   ::ShowCursor(false);
   ::SetWindowLongW(wnd, GWL_STYLE, 0);
   ::SetWindowLongW(wnd, GWL_EXSTYLE, WS_EX_LAYERED |
                    WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE);
-  ::SetWindowPos(wnd, HWND_TOPMOST, data->mBounds.x, data->mBounds.y,
-                 data->mBounds.width, data->mBounds.height, 0);
+  ::SetWindowPos(wnd, HWND_TOPMOST, data->mBounds.X(), data->mBounds.Y(),
+                 data->mBounds.Width(), data->mBounds.Height(), 0);
   data->mWnd = wnd;
   ::ReleaseSemaphore(data->mSemaphore, 1, nullptr);
   // The initialization data may no longer be valid
   // after we release the semaphore.
   data = nullptr;
 
   MSG msg;
   while (::GetMessageW(&msg, nullptr, 0, 0)) {
@@ -3421,20 +3406,20 @@ nsWindow::PrepareForFullscreenTransition
 
   FullscreenTransitionInitData initData;
   nsCOMPtr<nsIScreen> screen = GetWidgetScreen();
   int32_t x, y, width, height;
   screen->GetRectDisplayPix(&x, &y, &width, &height);
   MOZ_ASSERT(BoundsUseDesktopPixels(),
              "Should only be called on top-level window");
   double scale = GetDesktopToDeviceScale().scale; // XXX or GetDefaultScale() ?
-  initData.mBounds.x = NSToIntRound(x * scale);
-  initData.mBounds.y = NSToIntRound(y * scale);
-  initData.mBounds.width = NSToIntRound(width * scale);
-  initData.mBounds.height = NSToIntRound(height * scale);
+  initData.mBounds.SetRect(NSToIntRound(x * scale),
+                           NSToIntRound(y * scale),
+                           NSToIntRound(width * scale),
+                           NSToIntRound(height * scale));
 
   // Create a semaphore for synchronizing the window handle which will
   // be created by the transition thread and used by the main thread for
   // posting the transition messages.
   initData.mSemaphore = ::CreateSemaphore(nullptr, 0, 1, nullptr);
   if (initData.mSemaphore) {
     initData.mThread = ::CreateThread(
       nullptr, 0, FullscreenTransitionThreadProc, &initData, 0, nullptr);
@@ -4019,18 +4004,18 @@ nsWindow::OnDefaultButtonLoaded(const La
     if (!::SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0,
                                 &snapDefaultButton, 0) || !snapDefaultButton)
       return NS_OK;
   }
 
   LayoutDeviceIntRect widgetRect = GetScreenBounds();
   LayoutDeviceIntRect buttonRect(aButtonRect + widgetRect.TopLeft());
 
-  LayoutDeviceIntPoint centerOfButton(buttonRect.x + buttonRect.width / 2,
-                                      buttonRect.y + buttonRect.height / 2);
+  LayoutDeviceIntPoint 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)) {
     return NS_OK;
   }
 
   if (!::SetCursorPos(centerOfButton.x, centerOfButton.y)) {
     NS_ERROR("SetCursorPos failed");
@@ -4069,17 +4054,17 @@ nsWindow::UpdateThemeGeometries(const ns
 
   if (!IsWin10OrLater()) {
     for (size_t i = 0; i < aThemeGeometries.Length(); i++) {
       if (aThemeGeometries[i].mType == nsNativeThemeWin::eThemeGeometryTypeWindowButtons) {
         LayoutDeviceIntRect bounds = aThemeGeometries[i].mRect;
         // Extend the bounds by one pixel to the right, because that's how much
         // the actual window button shape extends past the client area of the
         // window (and overlaps the right window frame).
-        bounds.width += 1;
+        bounds.SetWidth(bounds.Width() + 1);
         if (!mWindowButtonsRect) {
           mWindowButtonsRect = Some(bounds);
         }
         clearRegion.Or(clearRegion, gfx::IntRect::Truncate(bounds.X(), bounds.Y(), bounds.Width(), bounds.Height() - 2.0));
         clearRegion.Or(clearRegion, gfx::IntRect::Truncate(bounds.X() + 1.0, bounds.YMost() - 2.0, bounds.Width() - 2.0, 1.0));
         clearRegion.Or(clearRegion, gfx::IntRect::Truncate(bounds.X() + 2.0, bounds.YMost() - 1.0, bounds.Width() - 4.0, 1.0));
       }
     }
@@ -4635,18 +4620,17 @@ nsWindow::DispatchMouseEvent(EventMessag
   pluginEvent.lParam = lParam;
 
   event.mPluginEvent.Copy(pluginEvent);
 
   // call the event callback
   if (mWidgetListener) {
     if (aEventMessage == eMouseMove) {
       LayoutDeviceIntRect rect = GetBounds();
-      rect.x = 0;
-      rect.y = 0;
+      rect.MoveTo(0, 0);
 
       if (rect.Contains(event.mRefPoint)) {
         if (sCurrentWindow == nullptr || sCurrentWindow != this) {
           if ((nullptr != sCurrentWindow) && (!sCurrentWindow->mInDtor)) {
             LPARAM pos = sCurrentWindow->lParamToClient(lParamToScreen(lParam));
             sCurrentWindow->DispatchMouseEvent(eMouseExitFromWidget,
                                                wParam, pos, false, 
                                                WidgetMouseEvent::eLeftButton,
@@ -6723,19 +6707,17 @@ void nsWindow::OnWindowPosChanged(WINDOW
 
     // Skip window size change events below on minimization.
     if (mSizeMode == nsSizeMode_Minimized)
       return;
   }
 
   // Handle window position changes
   if (!(wp->flags & SWP_NOMOVE)) {
-    mBounds.x = wp->x;
-    mBounds.y = wp->y;
-
+    mBounds.MoveTo(wp->x, wp->y);
     NotifyWindowMoved(wp->x, wp->y);
   }
 
   // Handle window size changes
   if (!(wp->flags & SWP_NOSIZE)) {
     RECT r;
     int32_t newWidth, newHeight;
 
@@ -6775,18 +6757,17 @@ void nsWindow::OnWindowPosChanged(WINDOW
       ::RedrawWindow(mWnd, &drect, nullptr,
                      RDW_INVALIDATE |
                      RDW_NOERASE |
                      RDW_NOINTERNALPAINT |
                      RDW_ERASENOW |
                      RDW_ALLCHILDREN);
     }
 
-    mBounds.width    = newWidth;
-    mBounds.height   = newHeight;
+    mBounds.SizeTo(newWidth, newHeight);
     mLastSize.width  = newWidth;
     mLastSize.height = newHeight;
 
 #ifdef WINSTATE_DEBUG_OUTPUT
     MOZ_LOG(gWindowsLog, LogLevel::Info, 
            ("*** Resize window: %d x %d x %d x %d\n", wp->x, wp->y, 
             newWidth, newHeight));
 #endif
@@ -6796,18 +6777,17 @@ void nsWindow::OnWindowPosChanged(WINDOW
       if (UpdateNonClientMargins(nsSizeMode_Maximized, true)) {
         // gecko resize event already sent by UpdateNonClientMargins.
         return;
       }
     }
 
     // Recalculate the width and height based on the client area for gecko events.
     if (::GetClientRect(mWnd, &r)) {
-      rect.width  = r.right - r.left;
-      rect.height = r.bottom - r.top;
+      rect.SizeTo(r.right - r.left, r.bottom - r.top);
     }
     
     // Send a gecko resize event
     OnResize(rect);
   }
 }
 
 void nsWindow::OnWindowPosChanging(LPWINDOWPOS& info)
@@ -7085,32 +7065,32 @@ nsWindow::ConfigureChildren(const nsTArr
     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);
     LayoutDeviceIntRect bounds = w->GetBounds();
     if (bounds.Size() != configuration.mBounds.Size()) {
-      w->Resize(configuration.mBounds.x, configuration.mBounds.y,
-                configuration.mBounds.width, configuration.mBounds.height,
+      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->Move(configuration.mBounds.X(), configuration.mBounds.Y());
 
 
       if (gfxWindowsPlatform::GetPlatform()->IsDirect2DBackend() ||
           GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_BASIC) {
         // XXX - Workaround for Bug 587508. This will invalidate the part of the
         // plugin window that might be touched by moving content somehow. The
         // underlying problem should be found and fixed!
         LayoutDeviceIntRegion r;
         r.Sub(bounds, configuration.mBounds);
-        r.MoveBy(-bounds.x,
-                 -bounds.y);
+        r.MoveBy(-bounds.X(),
+                 -bounds.Y());
         LayoutDeviceIntRect toInvalidate = r.GetBounds();
 
         WinUtils::InvalidatePluginAsWorkaround(w, toInvalidate);
       }
     }
     rv = w->SetWindowClipRegion(configuration.mClipRegion, false);
     NS_ENSURE_SUCCESS(rv, rv);
   }
@@ -7127,19 +7107,19 @@ CreateHRGNFromArray(const nsTArray<Layou
   RECT* rects = reinterpret_cast<RECT*>(data->Buffer);
   data->rdh.dwSize = sizeof(data->rdh);
   data->rdh.iType = RDH_RECTANGLES;
   data->rdh.nCount = aRects.Length();
   LayoutDeviceIntRect bounds;
   for (uint32_t i = 0; i < aRects.Length(); ++i) {
     const LayoutDeviceIntRect& r = aRects[i];
     bounds.UnionRect(bounds, r);
-    ::SetRect(&rects[i], r.x, r.y, r.XMost(), r.YMost());
-  }
-  ::SetRect(&data->rdh.rcBound, bounds.x, bounds.y, bounds.XMost(), bounds.YMost());
+    ::SetRect(&rects[i], r.X(), r.Y(), r.XMost(), r.YMost());
+  }
+  ::SetRect(&data->rdh.rcBound, bounds.X(), bounds.Y(), bounds.XMost(), bounds.YMost());
   return ::ExtCreateRegion(nullptr, buf.Length(), data);
 }
 
 nsresult
 nsWindow::SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
                               bool aIntersectWithExisting)
 {
   if (IsWindowClipRegionEqual(aRects)) {
@@ -7261,21 +7241,21 @@ void nsWindow::OnDestroy()
   // Clear the main HWND.
   mWnd = nullptr;
 }
 
 // Send a resize message to the listener
 bool nsWindow::OnResize(nsIntRect &aWindowRect)
 {
   bool result = mWidgetListener ?
-                mWidgetListener->WindowResized(this, aWindowRect.width, aWindowRect.height) : false;
+    mWidgetListener->WindowResized(this, aWindowRect.Width(), aWindowRect.Height()) : false;
 
   // If there is an attached view, inform it as well as the normal widget listener.
   if (mAttachedWidgetListener) {
-    return mAttachedWidgetListener->WindowResized(this, aWindowRect.width, aWindowRect.height);
+    return mAttachedWidgetListener->WindowResized(this, aWindowRect.Width(), aWindowRect.Height());
   }
 
   return result;
 }
 
 bool nsWindow::OnHotKey(WPARAM wParam, LPARAM lParam)
 {
   return true;
@@ -8286,20 +8266,20 @@ nsWindow::WidgetTypeSupportsAcceleration
 
 void
 nsWindow::SetCandidateWindowForPlugin(const CandidateWindowPosition& aPosition)
 {
   CANDIDATEFORM form;
   form.dwIndex = 0;
   if (aPosition.mExcludeRect) {
     form.dwStyle = CFS_EXCLUDE;
-    form.rcArea.left = aPosition.mRect.x;
-    form.rcArea.top = aPosition.mRect.y;
-    form.rcArea.right = aPosition.mRect.x + aPosition.mRect.width;
-    form.rcArea.bottom = aPosition.mRect.y + aPosition.mRect.height;
+    form.rcArea.left = aPosition.mRect.X();
+    form.rcArea.top = aPosition.mRect.Y();
+    form.rcArea.right = aPosition.mRect.XMost();
+    form.rcArea.bottom = aPosition.mRect.YMost();
   } else {
     form.dwStyle = CFS_CANDIDATEPOS;
   }
   form.ptCurrentPos.x = aPosition.mPoint.x;
   form.ptCurrentPos.y = aPosition.mPoint.y;
 
   IMEHandler::SetCandidateWindow(this, &form);
 }