Bug 540629 Full screen mode menubar should autohide but not be completely hidden r=IanN
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sun, 31 Jan 2010 21:47:15 +0000
changeset 4788 3d183cb5d8551071585c9d66605194acc0ac61e9
parent 4787 53a3e6596e64eb8e2c24e86cedcc8ce7ee893c5c
child 4789 2bbbd23b2b6254dab838dfb75d773f636ba08893
push idunknown
push userunknown
push dateunknown
reviewersIanN
bugs540629
Bug 540629 Full screen mode menubar should autohide but not be completely hidden r=IanN
suite/browser/fullScreen.js
suite/browser/navigator.css
--- a/suite/browser/fullScreen.js
+++ b/suite/browser/fullScreen.js
@@ -31,17 +31,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-var FullScreen = 
+var FullScreen =
 {
   toggle: function()
   {
     var show = window.fullScreen;
     // show/hide all menubars, toolbars, and statusbars (except the full screen toolbar)
     this.showXULChrome("toolbar", show);
     this.showXULChrome("statusbar", show);
 
@@ -50,17 +50,17 @@ var FullScreen =
       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;
     for (i = 0; i < els.length; ++i) {
       // XXX don't interfere with previously collapsed toolbars
@@ -97,16 +97,21 @@ var FullScreen =
           }
 
           restoreAttr("mode");
           restoreAttr("iconsize");
           restoreAttr("context"); // XXX see above
 
           els[i].removeAttribute("inFullscreen");
         }
+      } else if (els[i].getAttribute("type") == "menubar") {
+        if (aShow)
+          els[i].removeAttribute("autohide");
+        else
+          els[i].setAttribute("autohide", "true");
       } else {
         // 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");
       }
--- a/suite/browser/navigator.css
+++ b/suite/browser/navigator.css
@@ -38,13 +38,29 @@ panel[for="urlbar"] {
 }
 
 /* ::::: bookmarks menu ::::: */
 
 .isempty:not(:last-child) {
   display: none;
 }
 
+/* ::::: autohide the menubar for full screen on linux too ::::: */
+
+#toolbar-menubar[autohide="true"]
+{
+  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar-menubar-autohide");
+  overflow: hidden;
+}
+
+#toolbar-menubar[autohide="true"][inactive="true"]
+{
+  min-height: 0px !important;
+  height: 0px !important;
+  -moz-appearance: none !important;
+  border-style: none !important;
+}
+
 /* ::::: Wallpaper fix for Bug 435652. Remove when Bug 204743 is fixed ::::: */
 
 .textbox-input-box {
   overflow-x: hidden;
 }