Bug 1238310: Part 1 - Allow setting zoom for background tabs. r?adw draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 01 Apr 2016 15:16:52 -0700
changeset 353953 4c643683c24b984676e0823fa607949dff7e9111
parent 353817 f60bd9567a058bf0d4d5b35f0d53a46eba0aa500
child 353954 5da4e631789e8da63e45b0385131dbf6ae3e72f7
push id15974
push usermaglione.k@gmail.com
push dateWed, 20 Apr 2016 03:00:13 +0000
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.