Bug 1423558: Use BaseRect access methods instead of member variables in docshell r?sawang draft
authorMilan Sreckovic <milan@mozilla.com>
Wed, 10 Jan 2018 10:46:57 -0500
changeset 718577 dafe526a57251075f1be830f9176cf3cfa5f567c
parent 718505 d5f42a23909eb181274731b07e4984bfbd18557d
child 745533 b2ae00312482610b6e2e7f49320c402b899cd77c
push id94979
push userbmo:milan@mozilla.com
push dateWed, 10 Jan 2018 16:13:41 +0000
reviewerssawang
bugs1423558
milestone59.0a1
Bug 1423558: Use BaseRect access methods instead of member variables in docshell r?sawang MozReview-Commit-ID: CrdXCQkKdnh
docshell/base/nsDocShell.cpp
docshell/base/nsDocShellTreeOwner.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5563,18 +5563,17 @@ nsDocShell::GetDevicePixelsPerDesktopPix
 
   *aScale = 1.0;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::SetPosition(int32_t aX, int32_t aY)
 {
-  mBounds.x = aX;
-  mBounds.y = aY;
+  mBounds.MoveTo(aX, aY);
 
   if (mContentViewer) {
     NS_ENSURE_SUCCESS(mContentViewer->Move(aX, aY), NS_ERROR_FAILURE);
   }
 
   return NS_OK;
 }
 
@@ -5611,20 +5610,17 @@ nsDocShell::GetSize(int32_t* aWidth, int
 {
   return GetPositionAndSize(nullptr, nullptr, aWidth, aHeight);
 }
 
 NS_IMETHODIMP
 nsDocShell::SetPositionAndSize(int32_t aX, int32_t aY, int32_t aWidth,
                                int32_t aHeight, uint32_t aFlags)
 {
-  mBounds.x = aX;
-  mBounds.y = aY;
-  mBounds.width = aWidth;
-  mBounds.height = aHeight;
+  mBounds.SetRect(aX, aY, aWidth, aHeight);
 
   // Hold strong ref, since SetBounds can make us null out mContentViewer
   nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
   if (viewer) {
     uint32_t cvflags = (aFlags & nsIBaseWindow::eDelayResize) ?
                            nsIContentViewer::eDelayResize : 0;
     // XXX Border figured in here or is that handled elsewhere?
     nsresult rv = viewer->SetBoundsWithFlags(mBounds, cvflags);
@@ -5636,17 +5632,17 @@ nsDocShell::SetPositionAndSize(int32_t a
 
 NS_IMETHODIMP
 nsDocShell::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aWidth,
                                int32_t* aHeight)
 {
   if (mParentWidget) {
     // ensure size is up-to-date if window has changed resolution
     LayoutDeviceIntRect r = mParentWidget->GetClientBounds();
-    SetPositionAndSize(mBounds.x, mBounds.y, r.width, r.height, 0);
+    SetPositionAndSize(mBounds.X(), mBounds.Y(), r.Width(), r.Height(), 0);
   }
 
   // We should really consider just getting this information from
   // our window instead of duplicating the storage and code...
   if (aWidth || aHeight) {
     // Caller wants to know our size; make sure to give them up to
     // date information.
     nsCOMPtr<nsIDocument> doc(do_GetInterface(GetAsSupports(mParent)));
@@ -5659,26 +5655,26 @@ nsDocShell::GetPositionAndSize(int32_t* 
   return NS_OK;
 }
 
 void
 nsDocShell::DoGetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aWidth,
                                  int32_t* aHeight)
 {
   if (aX) {
-    *aX = mBounds.x;
+    *aX = mBounds.X();
   }
   if (aY) {
-    *aY = mBounds.y;
+    *aY = mBounds.Y();
   }
   if (aWidth) {
-    *aWidth = mBounds.width;
+    *aWidth = mBounds.Width();
   }
   if (aHeight) {
-    *aHeight = mBounds.height;
+    *aHeight = mBounds.Height();
   }
 }
 
 NS_IMETHODIMP
 nsDocShell::Repaint(bool aForce)
 {
   nsCOMPtr<nsIPresShell> presShell = GetPresShell();
   NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -442,18 +442,18 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocS
   NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
 
   NS_ENSURE_SUCCESS(
     presShell->ResizeReflow(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
     NS_ERROR_FAILURE);
 
   nsRect shellArea = presContext->GetVisibleArea();
 
-  int32_t browserCX = presContext->AppUnitsToDevPixels(shellArea.width);
-  int32_t browserCY = presContext->AppUnitsToDevPixels(shellArea.height);
+  int32_t browserCX = presContext->AppUnitsToDevPixels(shellArea.Width());
+  int32_t browserCY = presContext->AppUnitsToDevPixels(shellArea.Height());
 
   return webBrowserChrome->SizeBrowserTo(browserCX, browserCY);
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetPersistence(bool aPersistPosition,
                                     bool aPersistSize,
                                     bool aPersistSizeMode)