Bug 1173768 - Force TabsInTitlebar to re-update appearance after exiting fullscreen. r=Gijs
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 18 Jun 2015 21:13:42 +1000
changeset 249529 502391d38d886650ea71072c3d5ab9c50df8f5d6
parent 249528 7e03a233b801345e49ffe80a318a2638a227bc33
child 249530 ad76805ea0fbdb7eaa857be5a1814c6f03559688
push id28929
push userryanvm@gmail.com
push dateThu, 18 Jun 2015 19:51:41 +0000
treeherdermozilla-central@d56a1257088e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1173768
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1173768 - Force TabsInTitlebar to re-update appearance after exiting fullscreen. r=Gijs
browser/base/content/browser-fullScreen.js
browser/base/content/browser.js
--- a/browser/base/content/browser-fullScreen.js
+++ b/browser/base/content/browser-fullScreen.js
@@ -85,16 +85,22 @@ var FullScreen = {
       // mozfullscreenchange event fired, which could confuse content script.
       this.hideNavToolbox(document.mozFullScreen);
     }
     else {
       this.showNavToolbox(false);
       // This is needed if they use the context menu to quit fullscreen
       this._isPopupOpen = false;
       this.cleanup();
+      // In TabsInTitlebar._update(), we cancel the appearance update on
+      // resize event for exiting fullscreen, since that happens before we
+      // change the UI here in the "fullscreen" event. Hence we need to
+      // call it here to ensure the appearance is properly updated. See
+      // TabsInTitlebar._update() and bug 1173768.
+      TabsInTitlebar.updateAppearance(true);
     }
   },
 
   exitDomFullScreen : function() {
     document.mozCancelFullScreen();
   },
 
   handleEvent: function (event) {
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5061,17 +5061,25 @@ var TabsInTitlebar = {
       // _update is called on resize events, because the window is not ready
       // after sizemode events. However, we only care about the event when the
       // sizemode is different from the last time we updated the appearance of
       // the tabs in the titlebar.
       let sizemode = document.documentElement.getAttribute("sizemode");
       if (this._lastSizeMode == sizemode) {
         return;
       }
+      let oldSizeMode = this._lastSizeMode;
       this._lastSizeMode = sizemode;
+      // Don't update right now if we are leaving fullscreen, since the UI is
+      // still changing in the consequent "fullscreen" event. Code there will
+      // call this function again when everything is ready.
+      // See browser-fullScreen.js: FullScreen.toggle and bug 1173768.
+      if (oldSizeMode == "fullscreen") {
+        return;
+      }
     }
 
     for (let something in this._disallowed) {
       allowed = false;
       break;
     }
 
     let titlebar = $("titlebar");