bug 465020 - Toolbars are not hidden in Full Screen and Print Preview after Bug 428216, r+sr=Neil
authorPhilip Chee <philip.chee@gmail.com>
Sat, 15 Nov 2008 14:37:44 +0100
changeset 1116 837c86f7e3e6fd51dffb5a1b230526e2f21a30fb
parent 1115 f46a87cfb094ca6d990314b9944ebfb0185efb99
child 1117 2001b287dcbe3140cf1a0e0e4ae8e1e8c14fe688
push idunknown
push userunknown
push dateunknown
bugs465020, 428216
bug 465020 - Toolbars are not hidden in Full Screen and Print Preview after Bug 428216, r+sr=Neil
suite/browser/browser.js
suite/browser/fullScreen.js
--- a/suite/browser/browser.js
+++ b/suite/browser/browser.js
@@ -38,16 +38,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
 var gPrintSettingsAreGlobal = true;
 var gSavePrintSettings = true;
 var gChromeState = null; // chrome state before we went into print preview
 var gInPrintPreviewMode = false;
+var gNavToolbox = null;
 
 function getWebNavigation()
 {
   try {
     return getBrowser().webNavigation;
   } catch (e) {
     return null;
   }
--- a/suite/browser/fullScreen.js
+++ b/suite/browser/fullScreen.js
@@ -35,20 +35,31 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 var FullScreen = 
 {
   toggle: function()
   {
+    var show = window.fullScreen;
     // show/hide all menubars, toolbars, and statusbars (except the full screen toolbar)
-    this.showXULChrome("menubar", window.fullScreen);
-    this.showXULChrome("toolbar", window.fullScreen);
-    this.showXULChrome("statusbar", window.fullScreen);
+    this.showXULChrome("menubar", show);
+    this.showXULChrome("toolbar", show);
+    this.showXULChrome("statusbar", show);
+
+    var toolbox = getNavToolbox();
+    if (show)
+      toolbox.removeAttribute("inFullscreen");
+    else
+      toolbox.setAttribute("inFullscreen", true);
+
+    var controls = document.getElementsByAttribute("fullscreencontrol", "true");
+    for (let i = 0; i < controls.length; ++i)
+      controls[i].hidden = show;
   },
   
   showXULChrome: function(aTag, aShow)
   {
     var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
     var els = document.getElementsByTagNameNS(XULNS, aTag);
 
     var i;
@@ -96,21 +107,11 @@ var FullScreen =
         // use moz-collapsed so it doesn't persist hidden/collapsed,
         // so that new windows don't have missing toolbars
         if (aShow)
           els[i].removeAttribute("moz-collapsed");
         else
           els[i].setAttribute("moz-collapsed", "true");
       }
     }
-
-    var toolbox = getNavToolbox();
-    if (aShow)
-      toolbox.removeAttribute("inFullscreen");
-    else
-      toolbox.setAttribute("inFullscreen", true);
-
-    var controls = document.getElementsByAttribute("fullscreencontrol", "true");
-    for (i = 0; i < controls.length; ++i)
-      controls[i].hidden = aShow;
   }
 
 };