Bug 890156 - patch 0.1 - Switch from 'display pixels' to 'desktop pixels' terminology in widget code. r=kats
authorJonathan Kew <jkew@mozilla.com>
Wed, 25 Nov 2015 19:11:58 +0000
changeset 279686 b9c868d65f75d92d68a34c49ef326fb493ff0c59
parent 279685 8d6a782970351f4c8b09aa244dc3a2d18af7d523
child 279687 87b35034828d7c4fc4f1cfd0e6cba4e9ce0b1f92
push id70188
push userjkew@mozilla.com
push dateWed, 13 Jan 2016 08:42:41 +0000
treeherdermozilla-inbound@a9f9b36c1a2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs890156
milestone46.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 890156 - patch 0.1 - Switch from 'display pixels' to 'desktop pixels' terminology in widget code. r=kats
widget/cocoa/nsCocoaWindow.mm
widget/gtk/nsWindow.cpp
widget/nsBaseDragService.h
widget/nsBaseScreen.h
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
widget/nsIScreen.idl
widget/windows/nsScreenWin.h
widget/windows/nsWindow.cpp
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -199,17 +199,17 @@ FindTargetScreenForRect(const LayoutDevi
       targetScreen = screen;
     }
   }
   return targetScreen;
 }
 
 // fits the rect to the screen that contains the largest area of it,
 // or to aScreen if a screen is passed in
-// NB: this operates with aRect in global display pixels
+// NB: this operates with aRect in desktop pixels
 static void
 FitRectToVisibleAreaForScreen(LayoutDeviceIntRect& aRect, NSScreen* aScreen)
 {
   if (!aScreen) {
     aScreen = FindTargetScreenForRect(aRect);
   }
 
   nsIntRect screenBounds(nsCocoaUtils::CocoaRectToGeckoRect([aScreen visibleFrame]));
@@ -244,17 +244,17 @@ static bool UseNativePopupWindows()
 {
 #ifdef MOZ_USE_NATIVE_POPUP_WINDOWS
   return true;
 #else
   return false;
 #endif /* MOZ_USE_NATIVE_POPUP_WINDOWS */
 }
 
-// aRect here is specified in global display pixels
+// aRect here is specified in desktop pixels
 nsresult nsCocoaWindow::Create(nsIWidget* aParent,
                                nsNativeWidget aNativeParent,
                                const LayoutDeviceIntRect& aRect,
                                nsWidgetInitData* aInitData)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   // Because the hidden window is created outside of an event loop,
@@ -1178,17 +1178,17 @@ void nsCocoaWindow::SetSizeConstraints(c
   };
   [mWindow setMaxSize:maxSize];
 
   nsBaseWidget::SetSizeConstraints(c);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-// Coordinates are global display pixels
+// Coordinates are desktop pixels
 NS_IMETHODIMP nsCocoaWindow::Move(double aX, double aY)
 {
   if (!mWindow) {
     return NS_OK;
   }
 
   // The point we have is in Gecko coordinates (origin top-left). Convert
   // it to Cocoa ones (origin bottom-left).
@@ -1512,17 +1512,17 @@ nsCocoaWindow::DoMakeFullScreen(bool aFu
     EnteredFullScreen(aFullScreen, /* aNativeMode */ false);
   }
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-// Coordinates are global display pixels
+// Coordinates are desktop pixels
 nsresult nsCocoaWindow::DoResize(double aX, double aY,
                                  double aWidth, double aHeight,
                                  bool aRepaint,
                                  bool aConstrainToCurrentScreen)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   if (!mWindow || mInResize) {
@@ -1566,25 +1566,25 @@ nsresult nsCocoaWindow::DoResize(double 
   // the wrong place, leading to a visual jump.
   [mWindow setFrame:newFrame display:YES];
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-// Coordinates are global display pixels
+// Coordinates are desktop pixels
 NS_IMETHODIMP nsCocoaWindow::Resize(double aX, double aY,
                                     double aWidth, double aHeight,
                                     bool aRepaint)
 {
   return DoResize(aX, aY, aWidth, aHeight, aRepaint, false);
 }
 
-// Coordinates are global display pixels
+// Coordinates are desktop pixels
 NS_IMETHODIMP nsCocoaWindow::Resize(double aWidth, double aHeight, bool aRepaint)
 {
   double invScale = 1.0 / GetDefaultScale().scale;
   return DoResize(mBounds.x * invScale, mBounds.y * invScale,
                   aWidth, aHeight, aRepaint, true);
 }
 
 NS_IMETHODIMP nsCocoaWindow::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect)
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1081,17 +1081,17 @@ nsWindow::Show(bool aState)
     NativeShow(aState);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
 {
-    CSSToLayoutDeviceScale scale = BoundsUseDisplayPixels() ? GetDefaultScale()
+    CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels() ? GetDefaultScale()
                                     : CSSToLayoutDeviceScale(1.0);
     int32_t width = NSToIntRound(scale.scale * aWidth);
     int32_t height = NSToIntRound(scale.scale * aHeight);
     ConstrainSize(&width, &height);
 
     // For top-level windows, aWidth and aHeight should possibly be
     // interpreted as frame bounds, but NativeResize treats these as window
     // bounds (Bug 581866).
@@ -1113,17 +1113,17 @@ nsWindow::Resize(double aWidth, double a
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
                  bool aRepaint)
 {
-    CSSToLayoutDeviceScale scale = BoundsUseDisplayPixels() ? GetDefaultScale()
+    CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels() ? GetDefaultScale()
                                     : CSSToLayoutDeviceScale(1.0);
     int32_t width = NSToIntRound(scale.scale * aWidth);
     int32_t height = NSToIntRound(scale.scale * aHeight);
     ConstrainSize(&width, &height);
 
     int32_t x = NSToIntRound(scale.scale * aX);
     int32_t y = NSToIntRound(scale.scale * aY);
     mBounds.x = x;
@@ -1179,17 +1179,17 @@ nsWindow::IsEnabled() const
 
 
 NS_IMETHODIMP
 nsWindow::Move(double aX, double aY)
 {
     LOG(("nsWindow::Move [%p] %f %f\n", (void *)this,
          aX, aY));
 
-    CSSToLayoutDeviceScale scale = BoundsUseDisplayPixels() ? GetDefaultScale()
+    CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels() ? GetDefaultScale()
                                    : CSSToLayoutDeviceScale(1.0);
     int32_t x = NSToIntRound(aX * scale.scale);
     int32_t y = NSToIntRound(aY * scale.scale);
 
     if (mWindowType == eWindowType_toplevel ||
         mWindowType == eWindowType_dialog) {
         SetSizeMode(nsSizeMode_Normal);
     }
--- a/widget/nsBaseDragService.h
+++ b/widget/nsBaseDragService.h
@@ -83,17 +83,17 @@ protected:
    * Draw the drag image, if any, to a surface and return it. The drag image
    * is constructed from mImage if specified, or aDOMNode if mImage is null.
    *
    * aRegion may be used to draw only a subset of the element. This region
    * should be supplied using x and y coordinates measured in css pixels
    * that are relative to the upper-left corner of the window.
    *
    * aScreenX and aScreenY should be the screen coordinates of the mouse click
-   * for the drag. These are in global display pixels.
+   * for the drag. These are in desktop pixels.
    *
    * On return, aScreenDragRect will contain the screen coordinates of the
    * area being dragged. This is used by the platform-specific part of the
    * drag service to determine the drag feedback. This rect will be in the
    * device pixels of the presContext.
    *
    * If there is no drag image, the returned surface will be null, but
    * aScreenDragRect will still be set to the drag area.
--- a/widget/nsBaseScreen.h
+++ b/widget/nsBaseScreen.h
@@ -16,17 +16,17 @@ class nsBaseScreen : public nsIScreen
 public:
   nsBaseScreen();
 
   NS_DECL_ISUPPORTS
 
   // nsIScreen interface
 
   // These simply forward to the device-pixel versions;
-  // implementations where global display pixels may not correspond
+  // implementations where desktop pixels may not correspond
   // to per-screen device pixels must override.
   NS_IMETHOD GetRectDisplayPix(int32_t *outLeft,  int32_t *outTop,
                                int32_t *outWidth, int32_t *outHeight) override;
   NS_IMETHOD GetAvailRectDisplayPix(int32_t *outLeft,  int32_t *outTop,
                                     int32_t *outWidth, int32_t *outHeight) override;
 
   /**
    * Simple management of screen brightness locks. This abstract base class
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1348,19 +1348,19 @@ NS_METHOD nsBaseWidget::SetWindowClass(c
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_METHOD nsBaseWidget::MoveClient(double aX, double aY)
 {
   LayoutDeviceIntPoint clientOffset(GetClientOffset());
 
-  // GetClientOffset returns device pixels; scale back to display pixels
+  // GetClientOffset returns device pixels; scale back to desktop pixels
   // if that's what this widget uses for the Move/Resize APIs
-  CSSToLayoutDeviceScale scale = BoundsUseDisplayPixels()
+  CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels()
                                     ? GetDefaultScale()
                                     : CSSToLayoutDeviceScale(1.0);
   aX -= clientOffset.x * 1.0 / scale.scale;
   aY -= clientOffset.y * 1.0 / scale.scale;
 
   return Move(aX, aY);
 }
 
@@ -1369,19 +1369,19 @@ NS_METHOD nsBaseWidget::ResizeClient(dou
                                      bool aRepaint)
 {
   NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
   NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
 
   LayoutDeviceIntRect clientBounds;
   GetClientBounds(clientBounds);
 
-  // GetClientBounds and mBounds are device pixels; scale back to display pixels
+  // GetClientBounds and mBounds are device pixels; scale back to desktop pixels
   // if that's what this widget uses for the Move/Resize APIs
-  CSSToLayoutDeviceScale scale = BoundsUseDisplayPixels()
+  CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels()
                                     ? GetDefaultScale()
                                     : CSSToLayoutDeviceScale(1.0);
   double invScale = 1.0 / scale.scale;
   aWidth = mBounds.width * invScale + (aWidth - clientBounds.width * invScale);
   aHeight = mBounds.height * invScale + (aHeight - clientBounds.height * invScale);
 
   return Resize(aWidth, aHeight, aRepaint);
 }
@@ -1393,17 +1393,17 @@ NS_METHOD nsBaseWidget::ResizeClient(dou
                                      bool aRepaint)
 {
   NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
   NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
 
   LayoutDeviceIntRect clientBounds;
   GetClientBounds(clientBounds);
 
-  double scale = BoundsUseDisplayPixels() ? 1.0 / GetDefaultScale().scale : 1.0;
+  double scale = BoundsUseDesktopPixels() ? 1.0 / GetDefaultScale().scale : 1.0;
   aWidth = mBounds.width * scale + (aWidth - clientBounds.width * scale);
   aHeight = mBounds.height * scale + (aHeight - clientBounds.height * scale);
 
   LayoutDeviceIntPoint clientOffset(GetClientOffset());
   aX -= clientOffset.x * scale;
   aY -= clientOffset.y * scale;
 
   return Resize(aX, aY, aWidth, aHeight, aRepaint);
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -172,23 +172,23 @@ public:
   virtual void            EndRemoteDrawing() override { };
   virtual void            CleanupRemoteDrawing() override { };
   virtual void            UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override {}
   NS_IMETHOD              SetModal(bool aModal) override;
   virtual uint32_t        GetMaxTouchPoints() const override;
   NS_IMETHOD              SetWindowClass(const nsAString& xulWinType) override;
   virtual nsresult        SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects, bool aIntersectWithExisting) override;
   // Return whether this widget interprets parameters to Move and Resize APIs
-  // as "global display pixels" rather than "device pixels", and therefore
+  // as "desktop pixels" rather than "device pixels", and therefore
   // applies its GetDefaultScale() value to them before using them as mBounds
   // etc (which are always stored in device pixels).
   // Note that APIs that -get- the widget's position/size/bounds, rather than
   // -setting- them (i.e. moving or resizing the widget) will always return
   // values in the widget's device pixels.
-  bool                    BoundsUseDisplayPixels() const {
+  bool                    BoundsUseDesktopPixels() const {
     return mWindowType <= eWindowType_popup;
   }
   NS_IMETHOD              MoveClient(double aX, double aY) override;
   NS_IMETHOD              ResizeClient(double aWidth, double aHeight, bool aRepaint) override;
   NS_IMETHOD              ResizeClient(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
   NS_IMETHOD              GetBounds(LayoutDeviceIntRect& aRect) override;
   NS_IMETHOD              GetClientBounds(LayoutDeviceIntRect& aRect) override;
   NS_IMETHOD              GetScreenBounds(LayoutDeviceIntRect& aRect) override;
--- a/widget/nsIScreen.idl
+++ b/widget/nsIScreen.idl
@@ -37,17 +37,17 @@ interface nsIScreen : nsISupports
 
   /**
    * These report screen dimensions in (screen-specific) device pixels
    */
   void GetRect(out long left, out long top, out long width, out long height);
   void GetAvailRect(out long left, out long top, out long width, out long height);
 
   /**
-   * And these report in global display pixels
+   * And these report in desktop pixels
    */
   void GetRectDisplayPix(out long left, out long top, out long width, out long height);
   void GetAvailRectDisplayPix(out long left, out long top, out long width, out long height);
 
   /**
    * Locks the minimum brightness of the screen, forcing it to be at
    * least as bright as a certain brightness level. Each call to this
    * function must eventually be followed by a corresponding call to
--- a/widget/windows/nsScreenWin.h
+++ b/widget/windows/nsScreenWin.h
@@ -18,17 +18,17 @@ public:
   ~nsScreenWin();
 
   NS_IMETHOD GetId(uint32_t* aId);
 
   // These methods return the size in device (physical) pixels
   NS_IMETHOD GetRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight);
   NS_IMETHOD GetAvailRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight);
 
-  // And these methods get the screen size in 'display pixels' (AKA 'logical pixels')
+  // And these methods get the screen size in 'desktop pixels' (AKA 'logical pixels')
   // that are dependent on the logical DPI setting in windows
   NS_IMETHOD GetRectDisplayPix(int32_t *outLeft,  int32_t *outTop,
                                int32_t *outWidth, int32_t *outHeight);
   NS_IMETHOD GetAvailRectDisplayPix(int32_t *outLeft,  int32_t *outTop,
                                     int32_t *outWidth, int32_t *outHeight);
 
   NS_IMETHOD GetPixelDepth(int32_t* aPixelDepth);
   NS_IMETHOD GetColorDepth(int32_t* aColorDepth);
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1402,19 +1402,19 @@ nsWindow::SetSizeConstraints(const SizeC
 // Move this component
 NS_METHOD nsWindow::Move(double aX, double aY)
 {
   if (mWindowType == eWindowType_toplevel ||
       mWindowType == eWindowType_dialog) {
     SetSizeMode(nsSizeMode_Normal);
   }
 
-  // for top-level windows only, convert coordinates from global display pixels
+  // for top-level windows only, convert coordinates from desktop pixels
   // (the "parent" coordinate space) to the window's device pixel space
-  CSSToLayoutDeviceScale scale = BoundsUseDisplayPixels() ? GetDefaultScale()
+  CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels() ? GetDefaultScale()
                                     : CSSToLayoutDeviceScale(1.0);
   int32_t x = NSToIntRound(aX * scale.scale);
   int32_t y = NSToIntRound(aY * scale.scale);
 
   // 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
@@ -1470,19 +1470,19 @@ NS_METHOD nsWindow::Move(double aX, doub
   }
   NotifyRollupGeometryChange();
   return NS_OK;
 }
 
 // Resize this component
 NS_METHOD nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
 {
-  // for top-level windows only, convert coordinates from global display pixels
+  // for top-level windows only, convert coordinates from desktop pixels
   // (the "parent" coordinate space) to the window's device pixel space
-  CSSToLayoutDeviceScale scale = BoundsUseDisplayPixels() ? GetDefaultScale()
+  CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels() ? GetDefaultScale()
                                     : CSSToLayoutDeviceScale(1.0);
   int32_t width = NSToIntRound(aWidth * scale.scale);
   int32_t height = NSToIntRound(aHeight * scale.scale);
 
   NS_ASSERTION((width >= 0) , "Negative width passed to nsWindow::Resize");
   NS_ASSERTION((height >= 0), "Negative height passed to nsWindow::Resize");
 
   ConstrainSize(&width, &height);
@@ -1522,19 +1522,19 @@ NS_METHOD nsWindow::Resize(double aWidth
 
   NotifyRollupGeometryChange();
   return NS_OK;
 }
 
 // Resize this component
 NS_METHOD nsWindow::Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint)
 {
-  // for top-level windows only, convert coordinates from global display pixels
+  // for top-level windows only, convert coordinates from desktop pixels
   // (the "parent" coordinate space) to the window's device pixel space
-  CSSToLayoutDeviceScale scale = BoundsUseDisplayPixels() ? GetDefaultScale()
+  CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels() ? GetDefaultScale()
                                     : CSSToLayoutDeviceScale(1.0);
   int32_t x = NSToIntRound(aX * scale.scale);
   int32_t y = NSToIntRound(aY * scale.scale);
   int32_t width = NSToIntRound(aWidth * scale.scale);
   int32_t height = NSToIntRound(aHeight * scale.scale);
 
   NS_ASSERTION((width >= 0),  "Negative width passed to nsWindow::Resize");
   NS_ASSERTION((height >= 0), "Negative height passed to nsWindow::Resize");
@@ -3041,17 +3041,17 @@ nsWindow::PrepareForFullscreenTransition
   if (!nsUXThemeData::CheckForCompositor()) {
     return false;
   }
 
   FullscreenTransitionInitData initData;
   nsCOMPtr<nsIScreen> screen = GetWidgetScreen();
   int32_t x, y, width, height;
   screen->GetRectDisplayPix(&x, &y, &width, &height);
-  MOZ_ASSERT(BoundsUseDisplayPixels(),
+  MOZ_ASSERT(BoundsUseDesktopPixels(),
              "Should only be called on top-level window");
   CSSToLayoutDeviceScale scale = GetDefaultScale();
   initData.mBounds.x = NSToIntRound(x * scale.scale);
   initData.mBounds.y = NSToIntRound(y * scale.scale);
   initData.mBounds.width = NSToIntRound(width * scale.scale);
   initData.mBounds.height = NSToIntRound(height * scale.scale);
 
   // Create a semaphore for synchronizing the window handle which will