Bug 1074743 - Forward display pixel values to screen proxies r=jimm a=sylvestre
authorTim Taubert <ttaubert@mozilla.com>
Tue, 30 Sep 2014 18:28:28 -0700
changeset 216914 fa58aaa6863e
parent 216913 16aa4dfa9001
child 216915 d79568d581e6
push id3965
push userttaubert@mozilla.com
push date2014-10-02 17:41 +0000
treeherdermozilla-beta@fa58aaa6863e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, sylvestre
bugs1074743
milestone33.0
Bug 1074743 - Forward display pixel values to screen proxies r=jimm a=sylvestre
dom/ipc/PScreenManager.ipdl
dom/ipc/ScreenManagerParent.cpp
widget/xpwidgets/ScreenProxy.cpp
widget/xpwidgets/ScreenProxy.h
--- a/dom/ipc/PScreenManager.ipdl
+++ b/dom/ipc/PScreenManager.ipdl
@@ -9,17 +9,19 @@ include protocol PContent;
 using struct nsIntRect from "nsRect.h";
 
 namespace mozilla {
 namespace dom {
 
 struct ScreenDetails {
   uint32_t id;
   nsIntRect rect;
+  nsIntRect rectDisplayPix;
   nsIntRect availRect;
+  nsIntRect availRectDisplayPix;
   int32_t pixelDepth;
   int32_t colorDepth;
   double contentsScaleFactor;
 };
 
 sync protocol PScreenManager
 {
   manager PContent;
--- a/dom/ipc/ScreenManagerParent.cpp
+++ b/dom/ipc/ScreenManagerParent.cpp
@@ -156,22 +156,36 @@ ScreenManagerParent::ExtractScreenDetail
   NS_ENSURE_SUCCESS(rv, false);
   aDetails.id() = id;
 
   nsIntRect rect;
   rv = aScreen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
   NS_ENSURE_SUCCESS(rv, false);
   aDetails.rect() = rect;
 
+  nsIntRect rectDisplayPix;
+  rv = aScreen->GetRectDisplayPix(&rectDisplayPix.x, &rectDisplayPix.y,
+                                  &rectDisplayPix.width, &rectDisplayPix.height);
+  NS_ENSURE_SUCCESS(rv, false);
+  aDetails.rectDisplayPix() = rectDisplayPix;
+
   nsIntRect availRect;
   rv = aScreen->GetAvailRect(&availRect.x, &availRect.y, &availRect.width,
                              &availRect.height);
   NS_ENSURE_SUCCESS(rv, false);
   aDetails.availRect() = availRect;
 
+  nsIntRect availRectDisplayPix;
+  rv = aScreen->GetAvailRectDisplayPix(&availRectDisplayPix.x,
+                                       &availRectDisplayPix.y,
+                                       &availRectDisplayPix.width,
+                                       &availRectDisplayPix.height);
+  NS_ENSURE_SUCCESS(rv, false);
+  aDetails.availRectDisplayPix() = availRectDisplayPix;
+
   int32_t pixelDepth = 0;
   rv = aScreen->GetPixelDepth(&pixelDepth);
   NS_ENSURE_SUCCESS(rv, false);
   aDetails.pixelDepth() = pixelDepth;
 
   int32_t colorDepth = 0;
   rv = aScreen->GetColorDepth(&colorDepth);
   NS_ENSURE_SUCCESS(rv, false);
--- a/widget/xpwidgets/ScreenProxy.cpp
+++ b/widget/xpwidgets/ScreenProxy.cpp
@@ -46,16 +46,33 @@ ScreenProxy::GetRect(int32_t *outLeft,
   *outLeft = mRect.x;
   *outTop = mRect.y;
   *outWidth = mRect.width;
   *outHeight = mRect.height;
   return NS_OK;
 }
 
 NS_IMETHODIMP
+ScreenProxy::GetRectDisplayPix(int32_t *outLeft,
+                               int32_t *outTop,
+                               int32_t *outWidth,
+                               int32_t *outHeight)
+{
+  if (!EnsureCacheIsValid()) {
+    return NS_ERROR_FAILURE;
+  }
+
+  *outLeft = mRectDisplayPix.x;
+  *outTop = mRectDisplayPix.y;
+  *outWidth = mRectDisplayPix.width;
+  *outHeight = mRectDisplayPix.height;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 ScreenProxy::GetAvailRect(int32_t *outLeft,
                           int32_t *outTop,
                           int32_t *outWidth,
                           int32_t *outHeight)
 {
   if (!EnsureCacheIsValid()) {
     return NS_ERROR_FAILURE;
   }
@@ -63,16 +80,33 @@ ScreenProxy::GetAvailRect(int32_t *outLe
   *outLeft = mAvailRect.x;
   *outTop = mAvailRect.y;
   *outWidth = mAvailRect.width;
   *outHeight = mAvailRect.height;
   return NS_OK;
 }
 
 NS_IMETHODIMP
+ScreenProxy::GetAvailRectDisplayPix(int32_t *outLeft,
+                                    int32_t *outTop,
+                                    int32_t *outWidth,
+                                    int32_t *outHeight)
+{
+  if (!EnsureCacheIsValid()) {
+    return NS_ERROR_FAILURE;
+  }
+
+  *outLeft = mAvailRectDisplayPix.x;
+  *outTop = mAvailRectDisplayPix.y;
+  *outWidth = mAvailRectDisplayPix.width;
+  *outHeight = mAvailRectDisplayPix.height;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 ScreenProxy::GetPixelDepth(int32_t *aPixelDepth)
 {
   if (!EnsureCacheIsValid()) {
     return NS_ERROR_FAILURE;
   }
 
   *aPixelDepth = mPixelDepth;
   return NS_OK;
@@ -89,17 +123,19 @@ ScreenProxy::GetColorDepth(int32_t *aCol
   return NS_OK;
 }
 
 void
 ScreenProxy::PopulateByDetails(ScreenDetails aDetails)
 {
   mId = aDetails.id();
   mRect = nsIntRect(aDetails.rect());
+  mRectDisplayPix = nsIntRect(aDetails.rectDisplayPix());
   mAvailRect = nsIntRect(aDetails.availRect());
+  mAvailRectDisplayPix = nsIntRect(aDetails.availRectDisplayPix());
   mPixelDepth = aDetails.pixelDepth();
   mColorDepth = aDetails.colorDepth();
   mContentsScaleFactor = aDetails.contentsScaleFactor();
 }
 
 bool
 ScreenProxy::EnsureCacheIsValid()
 {
--- a/widget/xpwidgets/ScreenProxy.h
+++ b/widget/xpwidgets/ScreenProxy.h
@@ -24,37 +24,47 @@ public:
     ~ScreenProxy() {};
 
     NS_IMETHOD GetId(uint32_t* aId) MOZ_OVERRIDE;
 
     NS_IMETHOD GetRect(int32_t* aLeft,
                        int32_t* aTop,
                        int32_t* aWidth,
                        int32_t* aHeight) MOZ_OVERRIDE;
+    NS_IMETHOD GetRectDisplayPix(int32_t* aLeft,
+                                 int32_t* aTop,
+                                 int32_t* aWidth,
+                                 int32_t* aHeight) MOZ_OVERRIDE;
     NS_IMETHOD GetAvailRect(int32_t* aLeft,
                             int32_t* aTop,
                             int32_t* aWidth,
                             int32_t* aHeight) MOZ_OVERRIDE;
+    NS_IMETHOD GetAvailRectDisplayPix(int32_t* aLeft,
+                                      int32_t* aTop,
+                                      int32_t* aWidth,
+                                      int32_t* aHeight) MOZ_OVERRIDE;
     NS_IMETHOD GetPixelDepth(int32_t* aPixelDepth) MOZ_OVERRIDE;
     NS_IMETHOD GetColorDepth(int32_t* aColorDepth) MOZ_OVERRIDE;
 
 private:
 
     void PopulateByDetails(mozilla::dom::ScreenDetails aDetails);
     bool EnsureCacheIsValid();
     void InvalidateCacheOnNextTick();
     void InvalidateCache();
 
     double mContentsScaleFactor;
     nsRefPtr<nsScreenManagerProxy> mScreenManager;
     uint32_t mId;
     int32_t mPixelDepth;
     int32_t mColorDepth;
     nsIntRect mRect;
+    nsIntRect mRectDisplayPix;
     nsIntRect mAvailRect;
+    nsIntRect mAvailRectDisplayPix;
     bool mCacheValid;
     bool mCacheWillInvalidate;
 };
 
 } // namespace widget
 } // namespace mozilla
 #endif