Bug 1238310: Part 1 - Allow setting zoom for background tabs. r=adw
authorKris Maglione <maglione.k@gmail.com>
Fri, 01 Apr 2016 15:16:52 -0700
changeset 318282 517ccf702ca23a525440b0617aae4dd9a88559f5
parent 318281 ef9c1cc0a76ca05d459cda0a0d74266f5d916341
child 318283 660fd42c40243a9011595b694347ea42af0da06d
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1238310
milestone48.0a1
Bug 1238310: Part 1 - Allow setting zoom for background tabs. r=adw MozReview-Commit-ID: F7zQ30P510g
browser/base/content/browser-fullZoom.js
--- a/browser/base/content/browser-fullZoom.js
+++ b/browser/base/content/browser-fullZoom.js
@@ -265,21 +265,30 @@ var FullZoom = {
   enlarge: function FullZoom_enlarge() {
     ZoomManager.enlarge();
     let browser = gBrowser.selectedBrowser;
     this._ignorePendingZoomAccesses(browser);
     this._applyZoomToPref(browser);
   },
 
   /**
-   * Sets the zoom level of the page in the current browser to the global zoom
+   * Sets the zoom level for the given browser to the given floating
+   * point value, where 1 is the default zoom level.
+   */
+  setZoom: function (value, browser = gBrowser.selectedBrowser) {
+    ZoomManager.setZoomForBrowser(browser, value);
+    this._ignorePendingZoomAccesses(browser);
+    this._applyZoomToPref(browser);
+  },
+
+  /**
+   * Sets the zoom level of the page in the given browser to the global zoom
    * level.
    */
-  reset: function FullZoom_reset() {
-    let browser = gBrowser.selectedBrowser;
+  reset: function FullZoom_reset(browser = gBrowser.selectedBrowser) {
     let token = this._getBrowserToken(browser);
     this._getGlobalValue(browser, function (value) {
       if (token.isCurrent) {
         ZoomManager.setZoomForBrowser(browser, value === undefined ? 1 : value);
         this._ignorePendingZoomAccesses(browser);
         this._executeSoon(function () {
           // _getGlobalValue may be either sync or async, so notify asyncly so
           // observers are guaranteed consistent behavior.