Bug 1162752 - Prevent collapsing toolbar on fullscreen mode on OS X >= Lion. r=dao, a=sledru
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 14 May 2015 13:14:47 +1200
changeset 274740 c5ca17a3c738d2ab80d3434ac07493954e64365b
parent 274739 e8e924727dba81ce3edacac6ccbfeb7945b717ac
child 274741 448a2dea1c4ed6a347fb9dbc48ab479f706872bb
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, sledru
bugs1162752
milestone40.0a2
Bug 1162752 - Prevent collapsing toolbar on fullscreen mode on OS X >= Lion. r=dao, a=sledru
browser/base/content/browser-fullScreen.js
--- a/browser/base/content/browser-fullScreen.js
+++ b/browser/base/content/browser-fullScreen.js
@@ -45,31 +45,16 @@ var FullScreen = {
 #endif
 
     if (!this._fullScrToggler) {
       this._fullScrToggler = document.getElementById("fullscr-toggler");
       this._fullScrToggler.addEventListener("mouseover", this._expandCallback, false);
       this._fullScrToggler.addEventListener("dragenter", this._expandCallback, false);
     }
 
-    // On OS X Lion we don't want to hide toolbars when entering fullscreen, unless
-    // we're entering DOM fullscreen, in which case we should hide the toolbars.
-    // If we're leaving fullscreen, then we'll go through the exit code below to
-    // make sure toolbars are made visible in the case of DOM fullscreen.
-    if (enterFS && this.useLionFullScreen) {
-      if (document.mozFullScreen) {
-        this.showXULChrome("toolbar", false);
-      }
-      else {
-        gNavToolbox.setAttribute("inFullscreen", true);
-        document.documentElement.setAttribute("inFullscreen", true);
-      }
-      return;
-    }
-
     // show/hide menubars, toolbars (except the full screen toolbar)
     this.showXULChrome("toolbar", !enterFS);
 
     if (enterFS) {
       document.addEventListener("keypress", this._keyToggleCallback, false);
       document.addEventListener("popupshown", this._setPopupOpen, false);
       document.addEventListener("popuphidden", this._setPopupOpen, false);
       this._shouldAnimate = true;
@@ -233,19 +218,24 @@ var FullScreen = {
   // Checks whether we are allowed to collapse the chrome
   _isPopupOpen: false,
   _isChromeCollapsed: false,
   _safeToCollapse: function(forceHide)
   {
     if (!gPrefService.getBoolPref("browser.fullscreen.autohide"))
       return false;
 
-    // a popup menu is open in chrome: don't collapse chrome
-    if (!forceHide && this._isPopupOpen)
-      return false;
+    if (!forceHide) {
+      // a popup menu is open in chrome: don't collapse chrome
+      if (this._isPopupOpen)
+        return false;
+      // On OS X Lion we don't want to hide toolbars.
+      if (this.useLionFullScreen)
+        return false;
+    }
 
     // a textbox in chrome is focused (location bar anyone?): don't collapse chrome
     if (document.commandDispatcher.focusedElement &&
         document.commandDispatcher.focusedElement.ownerDocument == document &&
         document.commandDispatcher.focusedElement.localName == "input") {
       if (forceHide)
         // hidden textboxes that still have focus are bad bad bad
         document.commandDispatcher.focusedElement.blur();
@@ -443,17 +433,17 @@ var FullScreen = {
     gNavToolbox.style.marginTop = "";
 
     if (!this._isChromeCollapsed) {
       return;
     }
 
     // Track whether mouse is near the toolbox
     this._isChromeCollapsed = false;
-    if (trackMouse) {
+    if (trackMouse && !this.useLionFullScreen) {
       let rect = gBrowser.mPanelContainer.getBoundingClientRect();
       this._mouseTargetRect = {
         top: rect.top + 50,
         bottom: rect.bottom,
         left: rect.left,
         right: rect.right
       };
       MousePosTracker.addListener(this);