Bug 663886 Manual zoom reduction (85%) does not hold and returns to 100% with routine navigation within a website r=Neil.
authorhhaamu@gmail.com
Thu, 12 Jul 2012 01:58:51 +0800
changeset 10628 d63b11ddcd554b5ce23bfbc83d68eef4686fe51c
parent 10627 06898b5bcf86ff66cfecaf5c4538244246e3f11b
child 10629 dec978837c2cc023e5e22069f8badc3b6485d9b1
push id8025
push userphilip.chee@gmail.com
push dateWed, 11 Jul 2012 17:59:37 +0000
treeherdercomm-central@d63b11ddcd55 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs663886
Bug 663886 Manual zoom reduction (85%) does not hold and returns to 100% with routine navigation within a website r=Neil.
suite/common/viewZoomOverlay.js
suite/common/viewZoomOverlay.xul
--- a/suite/common/viewZoomOverlay.js
+++ b/suite/common/viewZoomOverlay.js
@@ -241,24 +241,39 @@ var FullZoom = {
     if (typeof this.globalValue != "undefined")
       ZoomManager.zoom = this.globalValue;
     else
       ZoomManager.zoom = this._ensureValid(1);
 
     this._removePref();
   },
 
+  setOther: function setZoomOther() {
+    var zoomOther = document.getElementById("menu_zoomOther");
+    // open dialog and ask for new value
+    var o = {value: zoomOther.getAttribute("value"),
+             zoomMin: ZoomManager.MIN * 100,
+             zoomMax: ZoomManager.MAX * 100};
+    window.openDialog("chrome://communicator/content/askViewZoom.xul",
+                      "", "chrome,modal,centerscreen", o);
+    if (o.zoomOK) {
+      zoomOther.setAttribute("value", o.value);
+      ZoomManager.zoom = o.value / 100;
+      this._applySettingToPref();
+    }
+  },
+
   /**
    * Set the zoom level for the current tab.
    *
    * Per nsPresContext::setFullZoom, we can set the zoom to its current value
    * without significant impact on performance, as the setting is only applied
    * if it differs from the current setting.  In fact getting the zoom and then
    * checking ourselves if it differs costs more.
-   * 
+   *
    * And perhaps we should always set the zoom even if it was more expensive,
    * since DocumentViewerImpl::SetTextZoom claims that child documents can have
    * a different text zoom (although it would be unusual), and it implies that
    * those child text zooms should get updated when the parent zoom gets set,
    * and perhaps the same is true for full zoom
    * (although DocumentViewerImpl::SetFullZoom doesn't mention it).
    *
    * So when we apply new zoom values to the browser, we simply set the zoom.
@@ -405,22 +420,8 @@ function updateZoomMenu() {
       if (item.getAttribute("value") == Math.round(ZoomManager.zoom * 100))
         item.setAttribute("checked","true");
       else
         item.removeAttribute("checked");
     }
     item = item.previousSibling;
   }
 }
-
-function setZoomOther() {
-  var zoomOther = document.getElementById("menu_zoomOther");
-  // open dialog and ask for new value
-  var o = {value: zoomOther.getAttribute("value"),
-           zoomMin: ZoomManager.MIN * 100,
-           zoomMax: ZoomManager.MAX * 100};
-  window.openDialog("chrome://communicator/content/askViewZoom.xul",
-                    "", "chrome,modal,centerscreen", o);
-  if (o.zoomOK) {
-    zoomOther.setAttribute("value", o.value);
-    ZoomManager.zoom = o.value / 100;
-  }
-}
--- a/suite/common/viewZoomOverlay.xul
+++ b/suite/common/viewZoomOverlay.xul
@@ -22,17 +22,17 @@
     <key                      key="&zoomEnlargeCmd.commandkey2;" command="cmd_zoomEnlarge" modifiers="accel"/>
     <key id="key_zoomReset"   key="&zoomResetCmd.commandkey;"    command="cmd_zoomReset"   modifiers="accel"/>
   </keyset>
 
   <commandset id="viewZoomCommands">
     <command id="cmd_zoomReduce"  oncommand="FullZoom.reduce();"/>
     <command id="cmd_zoomEnlarge" oncommand="FullZoom.enlarge();"/>
     <command id="cmd_zoomReset"   oncommand="FullZoom.reset();"/>
-    <command id="cmd_zoomOther"   oncommand="setZoomOther();"/>
+    <command id="cmd_zoomOther"   oncommand="FullZoom.setOther();"/>
     <command id="cmd_fullZoomToggle" oncommand="ZoomManager.toggleZoom();"/>
   </commandset>
 
   <menu id="menu_zoom">
     <menupopup id="menu_zoomPopup" onpopupshowing="updateZoomMenu();" oncommand="FullZoom.zoom(event.target.value / 100);">
       <menuitem id="menu_zoomReduce"
                 key="key_zoomReduce"
                 label="&zoomReduceCmd.label;"