Bug 524479: Secondary zoom mechanism works when in Preferences [r=combee]
authorMark Finkle <mfinkle@mozilla.com>
Mon, 23 Nov 2009 12:23:59 -0500
changeset 65837 c2265df5014c376ca8410b2edb100536b0b9c287
parent 65836 b4a6a533840a49d53d5e48da15593561c2cde7ac
child 65838 15b0fe60a8b9c30490cf0eb444481d640531bfaa
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscombee
bugs524479
Bug 524479: Secondary zoom mechanism works when in Preferences [r=combee]
mobile/chrome/content/Util.js
mobile/chrome/content/browser-ui.js
mobile/chrome/content/browser.xul
--- a/mobile/chrome/content/Util.js
+++ b/mobile/chrome/content/Util.js
@@ -163,16 +163,17 @@ let Util = {
     return "none";
   }
 };
 
 let Elements = {};
 
 [
   ["browserBundle",      "bundle_browser"],
+  ["contentShowing",     "bcast_contentShowing"],
 ].forEach(function (elementGlobal) {
   let [name, id] = elementGlobal;
   Elements.__defineGetter__(name, function () {
     let element = document.getElementById(id);
     if (!element)
       return null;
     delete Elements[name];
     return Elements[name] = element;
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -263,29 +263,32 @@ var BrowserUI = {
   },
 
   pushDialog : function pushDialog(aDialog) {
     // If we have a dialog push it on the stack and set the attr for CSS
     if (aDialog) {
       this.lockToolbar();
       this._dialogs.push(aDialog);
       document.getElementById("toolbar-main").setAttribute("dialog", "true");
+      Elements.contentShowing.setAttribute("disabled", "true");
     }
   },
 
   popDialog : function popDialog() {
     // Passing null means we pop the topmost dialog
     if (this._dialogs.length) {
       this._dialogs.pop();
       this.unlockToolbar();
     }
 
     // If no more dialogs are being displayed, remove the attr for CSS
-    if (!this._dialogs.length)
+    if (!this._dialogs.length) {
       document.getElementById("toolbar-main").removeAttribute("dialog");
+      Elements.contentShowing.removeAttribute("disabled");
+    }
   },
 
   pushPopup: function pushPopup(aPanel, aElements) {
     this._updatePopup();
     this._popup =  { "panel": aPanel, 
                      "elements": (aElements instanceof Array) ? aElements : [aElements] };
   },
 
@@ -581,23 +584,27 @@ var BrowserUI = {
 
   showPanel: function showPanel(aPage) {
     let panelUI = document.getElementById("panel-container");
 
     panelUI.hidden = false;
     panelUI.width = window.innerWidth;
     panelUI.height = window.innerHeight;
 
+    Elements.contentShowing.setAttribute("disabled", "true");
+
     if (aPage != undefined)
       this.switchPane(aPage);
   },
 
   hidePanel: function hidePanel() {
     let panelUI = document.getElementById("panel-container");
     panelUI.hidden = true;
+
+    Elements.contentShowing.removeAttribute("disabled");
   },
   
   switchTask: function switchTask() {
     try {
       let phone = Cc["@mozilla.org/phone/support;1"].createInstance(Ci.nsIPhoneSupport);
       phone.switchTask();
     } catch(e) { }
   },
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -84,16 +84,20 @@
   <script type="application/x-javascript" src="chrome://browser/content/TileManager.js"/>
   <script type="application/x-javascript" src="chrome://browser/content/BrowserView.js"/>
 
   <stringbundleset id="stringbundleset">
     <stringbundle id="bundle_browser" src="chrome://browser/locale/browser.properties"/>
     <stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
   </stringbundleset>
 
+  <broadcasterset id="broadcasterset">
+    <broadcaster id="bcast_contentShowing"/>
+  </broadcasterset>
+
   <commandset id="mainCommandSet">
     <!-- basic navigation -->
     <command id="cmd_back" label="&back.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_forward" label="&forward.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_reload" label="&reload.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_stop" label="&stop.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_go" label="&go.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_openLocation" label="&openLocation.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
@@ -108,18 +112,18 @@
     <!-- misc -->
     <command id="cmd_close" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_quit" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_menu" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_fullscreen" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_actions" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_panel" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_sanitize" oncommand="CommandUpdater.doCommand(this.id);"/>
-    <command id="cmd_zoomin" oncommand="CommandUpdater.doCommand(this.id);"/>
-    <command id="cmd_zoomout" oncommand="CommandUpdater.doCommand(this.id);"/>
+    <command id="cmd_zoomin" observes="bcast_contentShowing" oncommand="CommandUpdater.doCommand(this.id);"/>
+    <command id="cmd_zoomout" observes="bcast_contentShowing" oncommand="CommandUpdater.doCommand(this.id);"/>
 
     <!-- scrolling -->
     <command id="cmd_scrollPageUp" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_scrollPageDown" oncommand="CommandUpdater.doCommand(this.id);"/>
 
     <!-- editing -->
     <command id="cmd_cut" label="&cut.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
     <command id="cmd_copy" label="&copy.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
@@ -166,19 +170,16 @@
     <key id="key_quit" keycode="VK_F4" command="cmd_quit"/>
 #endif
 
     <!-- tabs -->
     <key id="key_newTab" key="t" modifiers="accel" command="cmd_newTab"/>
     <key id="key_closeTab" key="w" modifiers="accel" command="cmd_closeTab"/>
   </keyset>
 
-  <popupset id="mainPopupSet">
-  </popupset>
-
   <stack flex="1" id="stack">
     <scrollbox id="controls-scrollbox" style="overflow: hidden; -moz-box-orient: horizontal; position: relative;" flex="1">
       <vbox class="panel-dark">
         <spacer class="toolbar-height"/>
         <!-- Left toolbar -->
         <vbox id="tabs-container" class="panel-dark" flex="1">
           <vbox id="tabs" onselect="BrowserUI.selectTab(this);" onclosetab="BrowserUI.closeTab(this)" flex="1"/>
           <hbox id="tabs-controls">