Bug 886573 - make zoom controls display the right thing in Australis even in customize mode, r=jaws
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 04 Mar 2014 17:10:40 -0500
changeset 171749 1cec9e21e02b093f72e70df0a30d748df90ef4c9
parent 171748 6622c62be1d5d64a30ecbd2df09e324240405d78
child 171750 aefca2214dd2dbc2fea06a79e5b2dda0d4b4abe5
push id5449
push usergijskruitbosch@gmail.com
push dateTue, 04 Mar 2014 22:12:01 +0000
treeherderfx-team@aefca2214dd2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs886573
milestone30.0a1
Bug 886573 - make zoom controls display the right thing in Australis even in customize mode, r=jaws
browser/components/customizableui/src/CustomizableWidgets.jsm
--- a/browser/components/customizableui/src/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/src/CustomizableWidgets.jsm
@@ -411,24 +411,29 @@ const CustomizableWidgets = [{
         setAttributes(btnNode, aButton);
         node.appendChild(btnNode);
       });
 
       // The middle node is the 'Reset Zoom' button.
       let zoomResetButton = node.childNodes[2];
       let window = aDocument.defaultView;
       function updateZoomResetButton() {
+        let updateDisplay = true;
+        // Label should always show 100% in customize mode, so don't update:
+        if (aDocument.documentElement.hasAttribute("customizing")) {
+          updateDisplay = false;
+        }
         //XXXgijs in some tests we get called very early, and there's no docShell on the
         // tabbrowser. This breaks the zoom toolkit code (see bug 897410). Don't let that happen:
         let zoomFactor = 100;
         try {
           zoomFactor = Math.floor(window.ZoomManager.zoom * 100);
         } catch (e) {}
         zoomResetButton.setAttribute("label", CustomizableUI.getLocalizedProperty(
-          buttons[1], "label", [zoomFactor]
+          buttons[1], "label", [updateDisplay ? zoomFactor : 100]
         ));
       };
 
       // Register ourselves with the service so we know when the zoom prefs change.
       Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:zoomChange", false);
       Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:zoomReset", false);
       Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:location-change", false);
 
@@ -503,16 +508,28 @@ const CustomizableWidgets = [{
           Services.obs.removeObserver(updateZoomResetButton, "browser-fullZoom:zoomReset");
           Services.obs.removeObserver(updateZoomResetButton, "browser-fullZoom:location-change");
           let panel = aDoc.getElementById(kPanelId);
           panel.removeEventListener("popupshowing", updateZoomResetButton);
           let container = aDoc.defaultView.gBrowser.tabContainer;
           container.removeEventListener("TabSelect", updateZoomResetButton);
         }.bind(this),
 
+        onCustomizeStart: function(aWindow) {
+          if (aWindow.document == aDocument) {
+            updateZoomResetButton();
+          }
+        },
+
+        onCustomizeEnd: function(aWindow) {
+          if (aWindow.document == aDocument) {
+            updateZoomResetButton();
+          }
+        },
+
         onWidgetDrag: function(aWidgetId, aArea) {
           if (aWidgetId != this.id)
             return;
           aArea = aArea || this.currentArea;
           updateCombinedWidgetStyle(node, aArea, true);
         }.bind(this)
       };
       CustomizableUI.addListener(listener);