Bug 1516307 - Make nsIDOMWindowUtils.getResolution return the result value. r=botond
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Sun, 30 Dec 2018 01:15:27 +0000
changeset 509229 3d44c817561ab9020dd00882cc9db85afa756c00
parent 509228 1fd1e34371da3e3ab587a2311528b4ac235d0b67
child 509230 3790e0649bd7830a9bf169c13a134578a8d22333
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1516307
milestone66.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 1516307 - Make nsIDOMWindowUtils.getResolution return the result value. r=botond Differential Revision: https://phabricator.services.mozilla.com/D15318
accessible/jsat/Utils.jsm
dom/interfaces/base/nsIDOMWindowUtils.idl
gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
mobile/android/chrome/geckoview/GeckoViewContentChild.js
mobile/android/components/SessionStore.js
mobile/android/tests/browser/chrome/test_session_scroll_position.html
--- a/accessible/jsat/Utils.jsm
+++ b/accessible/jsat/Utils.jsm
@@ -173,19 +173,17 @@ var Utils = { // jshint ignore:line
   getVirtualCursor: function getVirtualCursor(aDocument) {
     let doc = (aDocument instanceof Ci.nsIAccessible) ? aDocument :
       this.AccService.getAccessibleFor(aDocument);
 
     return doc.QueryInterface(Ci.nsIAccessibleDocument).virtualCursor;
   },
 
   getContentResolution: function _getContentResolution(aAccessible) {
-    let res = { value: 1 };
-    aAccessible.document.window.windowUtils.getResolution(res);
-    return res.value;
+    return aAccessible.document.window.windowUtils.getResolution();
   },
 
   getBounds: function getBounds(aAccessible) {
     let objX = {}, objY = {}, objW = {}, objH = {};
     aAccessible.getBounds(objX, objY, objW, objH);
 
     return new Rect(objX.value, objY.value, objW.value, objH.value);
   },
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -215,17 +215,17 @@ interface nsIDOMWindowUtils : nsISupport
    *
    * This can be used to implement a non-reflowing scale-zoom, e.g.
    * for pinch-zoom on mobile platforms.
    *
    * The caller of this method must have chrome privileges.
    */
   void setResolutionAndScaleTo(in float aResolution);
 
-  void getResolution(out float aResolution);
+  float getResolution();
 
   /**
    * Set a resolution on the presShell which is the "restored" from history.
    * The display dimensions are compared to their current values and used
    * to scale the resolution value if necessary, e.g. if the device was
    * rotated between saving and restoring of the session data.
    * This resolution should be used when painting for the first time. Calling
    * this too late may have no effect.
--- a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
@@ -1,17 +1,17 @@
 // ownerGlobal isn't defined in content privileged windows.
 /* eslint-disable mozilla/use-ownerGlobal */
 
 // Utilities for synthesizing of native events.
 
 function getResolution() {
-  let resolution = { value: -1 }; // bogus value in case DWU fails us
-  SpecialPowers.getDOMWindowUtils(window).getResolution(resolution);
-  return resolution.value;
+  let resolution = -1; // bogus value in case DWU fails us
+  resolution = SpecialPowers.getDOMWindowUtils(window).getResolution();
+  return resolution;
 }
 
 function getPlatform() {
   if (navigator.platform.indexOf("Win") == 0) {
     return "windows";
   }
   if (navigator.platform.indexOf("Mac") == 0) {
     return "mac";
--- a/mobile/android/chrome/geckoview/GeckoViewContentChild.js
+++ b/mobile/android/chrome/geckoview/GeckoViewContentChild.js
@@ -83,22 +83,22 @@ class GeckoViewContentChild extends Geck
     removeEventListener("contextmenu", this, { capture: true });
   }
 
   collectSessionState() {
     let history = SessionHistory.collect(docShell);
     let [formdata, scrolldata] = this.Utils.mapFrameTree(content, FormData.collect, ssu.collectScrollPosition.bind(ssu));
 
     // Save the current document resolution.
-    let zoom = { value: 1 };
+    let zoom = 1;
     let domWindowUtils = content.windowUtils;
-    domWindowUtils.getResolution(zoom);
+    zoom = domWindowUtils.getResolution();
     scrolldata = scrolldata || {};
     scrolldata.zoom = {};
-    scrolldata.zoom.resolution = zoom.value;
+    scrolldata.zoom.resolution = zoom;
 
     // Save some data that'll help in adjusting the zoom level
     // when restoring in a different screen orientation.
     let displaySize = {};
     let width = {}, height = {};
     domWindowUtils.getContentViewerSize(width, height);
 
     displaySize.width = width.value;
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -931,21 +931,21 @@ SessionStore.prototype = {
     }
 
     // Save the scroll position itself.
     let content = aBrowser.contentWindow;
     let [scrolldata] = Utils.mapFrameTree(content, ssu.collectScrollPosition.bind(ssu));
     scrolldata = scrolldata || {};
 
     // Save the current document resolution.
-    let zoom = { value: 1 };
-    content.windowUtils.getResolution(zoom);
+    let zoom = 1;
+    zoom = content.windowUtils.getResolution();
     scrolldata.zoom = {};
-    scrolldata.zoom.resolution = zoom.value;
-    log("onTabScroll() zoom level: " + zoom.value);
+    scrolldata.zoom.resolution = zoom;
+    log("onTabScroll() zoom level: " + zoom);
 
     // Save some data that'll help in adjusting the zoom level
     // when restoring in a different screen orientation.
     scrolldata.zoom.displaySize = this._getContentViewerSize(content);
     log("onTabScroll() displayWidth: " + scrolldata.zoom.displaySize.width);
 
     // Save zoom and scroll data.
     data.scrolldata = scrolldata;
--- a/mobile/android/tests/browser/chrome/test_session_scroll_position.html
+++ b/mobile/android/tests/browser/chrome/test_session_scroll_position.html
@@ -67,28 +67,28 @@ https://bugzilla.mozilla.org/show_bug.cg
     }
     frame.scrollTo(x, y);
   }
 
   function checkScroll(browser, data) {
     let {x, y, zoom} = data;
     let utils = getFrame(browser, data).windowUtils;
 
-    let actualX = {}, actualY = {}, actualZoom = {};
-    utils.getResolution(actualZoom);
+    let actualX = {}, actualY = {};
+    let actualZoom = utils.getResolution();
     utils.getScrollXY(false, actualX, actualY);
 
     if (data.hasOwnProperty("x")) {
       is(actualX.value, x, "scrollX set correctly");
     }
     if (data.hasOwnProperty("y")) {
       is(actualY.value, y, "scrollY set correctly");
     }
     if (data.hasOwnProperty("zoom")) {
-      ok(fuzzyEquals(actualZoom.value, zoom), "zoom set correctly");
+      ok(fuzzyEquals(actualZoom, zoom), "zoom set correctly");
     }
   }
 
   function getScrollString(data) {
     let {x, y} = data;
     x = x || 0;
     y = y || 0;
     return x + "," + y;