Bug 1423558: Use BaseRect access methods instead of member variables in docshell r=freesamael
authorMilan Sreckovic <milan@mozilla.com>
Wed, 10 Jan 2018 10:46:57 -0500
changeset 452907 72da6def61e02e510a85141027143ccb060d1d77
parent 452906 89d7853edd6412328c70ffec3f451da3aa9b1f34
child 452908 ef2f9e08e01238ae5893951fa13aafdaa3146f45
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfreesamael
bugs1423558
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 1423558: Use BaseRect access methods instead of member variables in docshell r=freesamael 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)