Bug 1036003 - "Clean up formatting in nsScreenWin.cpp and nsScreenManagerWin.cpp". r=jmathies f=mconley
authorMike Conley <mconley>
Mon, 14 Jul 2014 09:52:00 +0200
changeset 216284 71bc8f4a5bb7364c91ffbee095e7a21d159e2623
parent 216283 aca7944ee3df0768cb9bc82e77c31e37c2487193
child 216285 61a09b7b7e9df01cf4c4c2a5265197d630142a97
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmathies
bugs1036003
milestone33.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 1036003 - "Clean up formatting in nsScreenWin.cpp and nsScreenManagerWin.cpp". r=jmathies f=mconley
widget/windows/nsScreenManagerWin.cpp
widget/windows/nsScreenWin.cpp
--- a/widget/windows/nsScreenManagerWin.cpp
+++ b/widget/windows/nsScreenManagerWin.cpp
@@ -4,28 +4,28 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsScreenManagerWin.h"
 #include "nsScreenWin.h"
 #include "gfxWindowsPlatform.h"
 #include "nsIWidget.h"
 
 
-BOOL CALLBACK CountMonitors ( HMONITOR, HDC, LPRECT, LPARAM ioCount ) ;
+BOOL CALLBACK CountMonitors(HMONITOR, HDC, LPRECT, LPARAM ioCount);
 
-nsScreenManagerWin :: nsScreenManagerWin ( )
+nsScreenManagerWin::nsScreenManagerWin()
   : mNumberOfScreens(0)
 {
   // nothing to do. I guess we could cache a bunch of information
   // here, but we want to ask the device at runtime in case anything
   // has changed.
 }
 
 
-nsScreenManagerWin :: ~nsScreenManagerWin()
+nsScreenManagerWin::~nsScreenManagerWin()
 {
 }
 
 
 // addref, release, QI
 NS_IMPL_ISUPPORTS(nsScreenManagerWin, nsIScreenManager)
 
 
@@ -33,32 +33,32 @@ NS_IMPL_ISUPPORTS(nsScreenManagerWin, ns
 // CreateNewScreenObject
 //
 // Utility routine. Creates a new screen object from the given device handle
 //
 // NOTE: For this "single-monitor" impl, we just always return the cached primary
 //        screen. This should change when a multi-monitor impl is done.
 //
 nsIScreen* 
-nsScreenManagerWin :: CreateNewScreenObject ( HMONITOR inScreen )
+nsScreenManagerWin::CreateNewScreenObject(HMONITOR inScreen)
 {
   nsIScreen* retScreen = nullptr;
   
   // look through our screen list, hoping to find it. If it's not there,
   // add it and return the new one.
-  for ( unsigned i = 0; i < mScreenList.Length(); ++i ) {
+  for (unsigned i = 0; i < mScreenList.Length(); ++i) {
     ScreenListItem& curr = mScreenList[i];
-    if ( inScreen == curr.mMon ) {
+    if (inScreen == curr.mMon) {
       NS_IF_ADDREF(retScreen = curr.mScreen.get());
       return retScreen;
     }
   } // for each screen.
  
   retScreen = new nsScreenWin(inScreen);
-  mScreenList.AppendElement ( ScreenListItem ( inScreen, retScreen ) );
+  mScreenList.AppendElement(ScreenListItem(inScreen, retScreen));
 
   NS_IF_ADDREF(retScreen);
   return retScreen;
 }
 
 NS_IMETHODIMP
 nsScreenManagerWin::ScreenForId(uint32_t aId, nsIScreen **outScreen)
 {
@@ -81,88 +81,88 @@ nsScreenManagerWin::ScreenForId(uint32_t
 // ScreenForRect 
 //
 // Returns the screen that contains the rectangle. If the rect overlaps
 // multiple screens, it picks the screen with the greatest area of intersection.
 //
 // The coordinates are in pixels (not twips) and in logical screen coordinates.
 //
 NS_IMETHODIMP
-nsScreenManagerWin :: ScreenForRect ( int32_t inLeft, int32_t inTop, int32_t inWidth, int32_t inHeight,
-                                        nsIScreen **outScreen )
+nsScreenManagerWin::ScreenForRect(int32_t inLeft, int32_t inTop, int32_t inWidth, int32_t inHeight,
+                                  nsIScreen **outScreen)
 {
-  if ( !(inWidth || inHeight) ) {
-    NS_WARNING ( "trying to find screen for sizeless window, using primary monitor" );
-    *outScreen = CreateNewScreenObject ( nullptr );    // addrefs
+  if (!(inWidth || inHeight)) {
+    NS_WARNING("trying to find screen for sizeless window, using primary monitor");
+    *outScreen = CreateNewScreenObject(nullptr);    // addrefs
     return NS_OK;
   }
 
   // convert coordinates from logical to device pixels for MonitorFromRect
   double dpiScale = nsIWidget::DefaultScaleOverride();
   if (dpiScale <= 0.0) {
     dpiScale = gfxWindowsPlatform::GetPlatform()->GetDPIScale(); 
   }
   RECT globalWindowBounds = {
     NSToIntRound(dpiScale * inLeft),
     NSToIntRound(dpiScale * inTop),
     NSToIntRound(dpiScale * (inLeft + inWidth)),
     NSToIntRound(dpiScale * (inTop + inHeight))
   };
 
-  HMONITOR genScreen = ::MonitorFromRect( &globalWindowBounds, MONITOR_DEFAULTTOPRIMARY );
-
-  *outScreen = CreateNewScreenObject ( genScreen );    // addrefs
-  
+  HMONITOR genScreen = ::MonitorFromRect(&globalWindowBounds, MONITOR_DEFAULTTOPRIMARY);
+ 
+  *outScreen = CreateNewScreenObject(genScreen);    // addrefs
+ 
   return NS_OK;
     
 } // ScreenForRect
 
 
 //
 // GetPrimaryScreen
 //
 // The screen with the menubar/taskbar. This shouldn't be needed very
 // often.
 //
 NS_IMETHODIMP 
-nsScreenManagerWin :: GetPrimaryScreen(nsIScreen** aPrimaryScreen) 
+nsScreenManagerWin::GetPrimaryScreen(nsIScreen** aPrimaryScreen) 
 {
-  *aPrimaryScreen = CreateNewScreenObject ( nullptr );    // addrefs  
+  *aPrimaryScreen = CreateNewScreenObject(nullptr);    // addrefs  
   return NS_OK;
   
 } // GetPrimaryScreen
 
 
 //
 // CountMonitors
 //
 // Will be called once for every monitor in the system. Just 
 // increments the parameter, which holds a ptr to a PRUin32 holding the
 // count up to this point.
 //
 BOOL CALLBACK
-CountMonitors ( HMONITOR, HDC, LPRECT, LPARAM ioParam )
+CountMonitors(HMONITOR, HDC, LPRECT, LPARAM ioParam)
 {
   uint32_t* countPtr = reinterpret_cast<uint32_t*>(ioParam);
   ++(*countPtr);
 
   return TRUE; // continue the enumeration
 
 } // CountMonitors
 
 
 //
 // GetNumberOfScreens
 //
 // Returns how many physical screens are available.
 //
 NS_IMETHODIMP
-nsScreenManagerWin :: GetNumberOfScreens(uint32_t *aNumberOfScreens)
+nsScreenManagerWin::GetNumberOfScreens(uint32_t *aNumberOfScreens)
 {
-  if ( mNumberOfScreens )
+  if (mNumberOfScreens)
     *aNumberOfScreens = mNumberOfScreens;
   else {
     uint32_t count = 0;
     BOOL result = ::EnumDisplayMonitors(nullptr, nullptr, (MONITORENUMPROC)CountMonitors, (LPARAM)&count);
     if (!result)
       return NS_ERROR_FAILURE;
     *aNumberOfScreens = mNumberOfScreens = count;
   }
@@ -174,14 +174,14 @@ nsScreenManagerWin :: GetNumberOfScreens
 NS_IMETHODIMP
 nsScreenManagerWin::GetSystemDefaultScale(float *aDefaultScale)
 {
   *aDefaultScale = float(gfxWindowsPlatform::GetPlatform()->GetDPIScale());
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsScreenManagerWin :: ScreenForNativeWidget(void *aWidget, nsIScreen **outScreen)
+nsScreenManagerWin::ScreenForNativeWidget(void *aWidget, nsIScreen **outScreen)
 {
-  HMONITOR mon = MonitorFromWindow ((HWND) aWidget, MONITOR_DEFAULTTOPRIMARY);
-  *outScreen = CreateNewScreenObject (mon);
+  HMONITOR mon = MonitorFromWindow((HWND) aWidget, MONITOR_DEFAULTTOPRIMARY);
+  *outScreen = CreateNewScreenObject(mon);
   return NS_OK;
 }
--- a/widget/windows/nsScreenWin.cpp
+++ b/widget/windows/nsScreenWin.cpp
@@ -5,56 +5,56 @@
 
 #include "nsScreenWin.h"
 #include "nsCoord.h"
 #include "gfxWindowsPlatform.h"
 #include "nsIWidget.h"
 
 static uint32_t sScreenId;
 
-nsScreenWin :: nsScreenWin ( HMONITOR inScreen )
+nsScreenWin::nsScreenWin(HMONITOR inScreen)
   : mScreen(inScreen)
   , mId(++sScreenId)
 {
 #ifdef DEBUG
   HDC hDCScreen = ::GetDC(nullptr);
   NS_ASSERTION(hDCScreen,"GetDC Failure");
-  NS_ASSERTION ( ::GetDeviceCaps(hDCScreen, TECHNOLOGY) == DT_RASDISPLAY, "Not a display screen");
+  NS_ASSERTION(::GetDeviceCaps(hDCScreen, TECHNOLOGY) == DT_RASDISPLAY, "Not a display screen");
   ::ReleaseDC(nullptr,hDCScreen);
 #endif
 
   // nothing else to do. I guess we could cache a bunch of information
   // here, but we want to ask the device at runtime in case anything
   // has changed.
 }
 
 
-nsScreenWin :: ~nsScreenWin()
+nsScreenWin::~nsScreenWin()
 {
   // nothing to see here.
 }
 
 
 NS_IMETHODIMP
 nsScreenWin::GetId(uint32_t *outId)
 {
   *outId = mId;
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsScreenWin :: GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
+nsScreenWin::GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
 {
   BOOL success = FALSE;
-  if ( mScreen ) {
+  if (mScreen) {
     MONITORINFO info;
     info.cbSize = sizeof(MONITORINFO);
-    success = ::GetMonitorInfoW( mScreen, &info );
-    if ( success ) {
+    success = ::GetMonitorInfoW(mScreen, &info);
+    if (success) {
       *outLeft = info.rcMonitor.left;
       *outTop = info.rcMonitor.top;
       *outWidth = info.rcMonitor.right - info.rcMonitor.left;
       *outHeight = info.rcMonitor.bottom - info.rcMonitor.top;
     }
   }
   if (!success) {
      HDC hDCScreen = ::GetDC(nullptr);
@@ -67,25 +67,25 @@ nsScreenWin :: GetRect(int32_t *outLeft,
      ::ReleaseDC(nullptr, hDCScreen);
   }
   return NS_OK;
 
 } // GetRect
 
 
 NS_IMETHODIMP
-nsScreenWin :: GetAvailRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
+nsScreenWin::GetAvailRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
 {
   BOOL success = FALSE;
 
-  if ( mScreen ) {
+  if (mScreen) {
     MONITORINFO info;
     info.cbSize = sizeof(MONITORINFO);
-    success = ::GetMonitorInfoW( mScreen, &info );
-    if ( success ) {
+    success = ::GetMonitorInfoW(mScreen, &info);
+    if (success) {
       *outLeft = info.rcWork.left;
       *outTop = info.rcWork.top;
       *outWidth = info.rcWork.right - info.rcWork.left;
       *outHeight = info.rcWork.bottom - info.rcWork.top;
     }
   }
   if (!success) {
     RECT workArea;
@@ -163,15 +163,15 @@ nsScreenWin :: GetPixelDepth(int32_t *aP
 
   ::ReleaseDC(nullptr, hDCScreen);
   return NS_OK;
 
 } // GetPixelDepth
 
 
 NS_IMETHODIMP 
-nsScreenWin :: GetColorDepth(int32_t *aColorDepth)
+nsScreenWin::GetColorDepth(int32_t *aColorDepth)
 {
   return GetPixelDepth(aColorDepth);
 
 } // GetColorDepth