Bug 1423552: Use BaseRect access methods instead of member variables in hal/ r?gsvelto draft
authorMilan Sreckovic <milan@mozilla.com>
Wed, 10 Jan 2018 11:17:58 -0500
changeset 718581 d0aa16b531d60b56cf85119e9845f68b9da0fd2b
parent 718505 d5f42a23909eb181274731b07e4984bfbd18557d
child 745537 55e6be0f10e2a6dfd20f7a82a54494aa418c9d3f
push id94983
push userbmo:milan@mozilla.com
push dateWed, 10 Jan 2018 16:18:17 +0000
reviewersgsvelto
bugs1423552
milestone59.0a1
Bug 1423552: Use BaseRect access methods instead of member variables in hal/ r?gsvelto MozReview-Commit-ID: 625X8dMPL2n
hal/android/AndroidHal.cpp
hal/fallback/FallbackScreenConfiguration.h
--- a/hal/android/AndroidHal.cpp
+++ b/hal/android/AndroidHal.cpp
@@ -118,31 +118,34 @@ GetCurrentScreenConfiguration(ScreenConf
   nsresult rv;
   nsCOMPtr<nsIScreenManager> screenMgr =
     do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
   if (NS_FAILED(rv)) {
     NS_ERROR("Can't find nsIScreenManager!");
     return;
   }
 
-  nsIntRect rect;
   int32_t colorDepth, pixelDepth;
   int16_t angle;
   ScreenOrientationInternal orientation;
   nsCOMPtr<nsIScreen> screen;
 
+  int32_t rectX, rectY, rectWidth, rectHeight;
+
   screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
-  screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
+  
+  screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
   screen->GetColorDepth(&colorDepth);
   screen->GetPixelDepth(&pixelDepth);
   orientation = static_cast<ScreenOrientationInternal>(bridge->GetScreenOrientation());
   angle = bridge->GetScreenAngle();
 
   *aScreenConfiguration =
-    hal::ScreenConfiguration(rect, orientation, angle, colorDepth, pixelDepth);
+    hal::ScreenConfiguration(nsIntRect(rectX, rectY, rectWidth, rectHeight),
+                             orientation, angle, colorDepth, pixelDepth);
 }
 
 bool
 LockScreenOrientation(const ScreenOrientationInternal& aOrientation)
 {
   // Force the default orientation to be portrait-primary.
   ScreenOrientationInternal orientation =
     aOrientation == eScreenOrientation_Default ? eScreenOrientation_PortraitPrimary
--- a/hal/fallback/FallbackScreenConfiguration.h
+++ b/hal/fallback/FallbackScreenConfiguration.h
@@ -19,29 +19,29 @@ GetCurrentScreenConfiguration(hal::Scree
   nsresult rv;
   nsCOMPtr<nsIScreenManager> screenMgr =
     do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
   if (NS_FAILED(rv)) {
     NS_ERROR("Can't find nsIScreenManager!");
     return;
   }
 
-  nsIntRect rect;
-  int32_t colorDepth, pixelDepth;
+  int32_t colorDepth, pixelDepth, x, y, w, h;
   dom::ScreenOrientationInternal orientation;
   nsCOMPtr<nsIScreen> screen;
 
   screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
-  screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
+  screen->GetRect(&x, &y, &w, &h);
   screen->GetColorDepth(&colorDepth);
   screen->GetPixelDepth(&pixelDepth);
-  orientation = rect.width >= rect.height
+  orientation = w >= h
                 ? dom::eScreenOrientation_LandscapePrimary
                 : dom::eScreenOrientation_PortraitPrimary;
 
-  *aScreenConfiguration =
-      hal::ScreenConfiguration(rect, orientation, 0, colorDepth, pixelDepth);
+  *aScreenConfiguration = hal::ScreenConfiguration(nsIntRect(x, y, w, h),
+						   orientation, 0,
+						   colorDepth, pixelDepth);
 }
 
 }
 }
 
 #endif // mozilla_fallback_FallbackScreenConfiguration_h