Bug 1446343 part 1 - Expose GetOuterToInner{Width,Height}DifferenceInCSSPixels to script. r=bz
authorXidorn Quan <me@upsuper.org>
Fri, 06 Apr 2018 14:59:11 +1000
changeset 468285 aa7d70282996bde72068147bbf673be4a7da1bcf
parent 468284 2895c15cb623f6c2e277aba416f66561590c60be
child 468286 ba7856d07da4ec19730d8d8dda64b746ce920d98
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1446343
milestone61.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 1446343 part 1 - Expose GetOuterToInner{Width,Height}DifferenceInCSSPixels to script. r=bz MozReview-Commit-ID: 8mjIxRATTPD
xpfe/appshell/nsIXULWindow.idl
xpfe/appshell/nsXULWindow.cpp
--- a/xpfe/appshell/nsIXULWindow.idl
+++ b/xpfe/appshell/nsIXULWindow.idl
@@ -21,17 +21,17 @@
 interface nsIDocShell;
 interface nsIDocShellTreeItem;
 interface nsIXULBrowserWindow;
 interface nsITabParent;
 interface mozIDOMWindowProxy;
 
 native LiveResizeListenerArray(nsTArray<RefPtr<mozilla::LiveResizeListener>>);
 
-[scriptable, uuid(d6d7a014-e28d-4c9d-8727-1cf6d870619b)]
+[builtinclass, scriptable, uuid(d6d7a014-e28d-4c9d-8727-1cf6d870619b)]
 interface nsIXULWindow : nsISupports
 {
   /**
    * The docshell owning the XUL for this window.
    */
   readonly attribute nsIDocShell docShell;
 
   /**
@@ -65,18 +65,18 @@ interface nsIXULWindow : nsISupports
    * @param aChild the child window being added
    */
   void addChildWindow(in nsIXULWindow aChild);
 
   /**
    * Returns the difference between the inner window size (client size) and the
    * outer window size, in CSS pixels.
    */
-  [noscript,notxpcom] uint32_t getOuterToInnerHeightDifferenceInCSSPixels();
-  [noscript,notxpcom] uint32_t getOuterToInnerWidthDifferenceInCSSPixels();
+  [infallible] readonly attribute unsigned long outerToInnerHeightDifferenceInCSSPixels;
+  [infallible] readonly attribute unsigned long outerToInnerWidthDifferenceInCSSPixels;
 
   /**
    * Tell this window that it has lost a child XUL window
    * @param aChild the child window being removed
    */
   void removeChildWindow(in nsIXULWindow aChild);
 
   /**
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -356,26 +356,28 @@ GetOuterToInnerSizeDifferenceInCSSPixels
 {
   if (!aWindow) {
     return { };
   }
   LayoutDeviceIntSize devPixelSize = GetOuterToInnerSizeDifference(aWindow);
   return RoundedToInt(devPixelSize / aWindow->GetDefaultScale());
 }
 
-uint32_t
-nsXULWindow::GetOuterToInnerHeightDifferenceInCSSPixels()
+NS_IMETHODIMP
+nsXULWindow::GetOuterToInnerHeightDifferenceInCSSPixels(uint32_t* aResult)
 {
-  return GetOuterToInnerSizeDifferenceInCSSPixels(mWindow).height;
+  *aResult = GetOuterToInnerSizeDifferenceInCSSPixels(mWindow).height;
+  return NS_OK;
 }
 
-uint32_t
-nsXULWindow::GetOuterToInnerWidthDifferenceInCSSPixels()
+NS_IMETHODIMP
+nsXULWindow::GetOuterToInnerWidthDifferenceInCSSPixels(uint32_t* aResult)
 {
-  return GetOuterToInnerSizeDifferenceInCSSPixels(mWindow).width;
+  *aResult = GetOuterToInnerSizeDifferenceInCSSPixels(mWindow).width;
+  return NS_OK;
 }
 
 nsTArray<RefPtr<mozilla::LiveResizeListener>>
 nsXULWindow::GetLiveResizeListeners()
 {
   nsTArray<RefPtr<mozilla::LiveResizeListener>> listeners;
   if (mPrimaryTabParent) {
     TabParent* parent = static_cast<TabParent*>(mPrimaryTabParent.get());