From 6fb5b1a0e3ea4478a05407d100aed71339e5c6df Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Thu, 21 Nov 2013 00:01:39 +0900 Subject: [PATCH] Activate "tabs in titlebar" mode only when the menubar is hidden --- modules/browserUIShowHideObserver.js | 8 +++++++- modules/window.js | 13 ++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/browserUIShowHideObserver.js b/modules/browserUIShowHideObserver.js index 6c6772d8..f9dde4b3 100644 --- a/modules/browserUIShowHideObserver.js +++ b/modules/browserUIShowHideObserver.js @@ -124,11 +124,17 @@ BrowserUIShowHideObserver.prototype = { aMutations.forEach(function(aMutation) { if (aMutation.type != 'attributes') return; + if (aTargetElement.id == 'toolbar-menubar' && + aMutation.attributeName == 'autohide') { + this.owner.updateTabsInTitlebarForMenubar(); + return; + } if (aMutation.attributeName == 'hidden' || aMutation.attributeName == 'collapsed' || aMutation.attributeName == 'moz-collapsed' || // Used in full screen mode - aMutation.attributeName == 'disablechrome') + aMutation.attributeName == 'disablechrome') { TST.updateFloatingTabbar(TreeStyleTabConstants.kTABBAR_UPDATE_BY_WINDOW_RESIZE); + } }, this); }, diff --git a/modules/window.js b/modules/window.js index afbe5420..bb2a3286 100644 --- a/modules/window.js +++ b/modules/window.js @@ -387,6 +387,7 @@ TreeStyleTabWindow.prototype = { this.processRestoredTabs(); this.updateTabsOnTop(); + this.updateTabsInTitlebarForMenubar(); // Init autohide service only if it have to be activated. if (this.isAutoHide) @@ -451,6 +452,16 @@ TreeStyleTabWindow.prototype = { }, this); }, + updateTabsInTitlebarForMenubar : function TSTWindow_updateTabsInTitlebarForMenubar() + { + if (!this.window.TabsInTitlebar) + return; + + var menubar = this.document.querySelector('#toolbar-menubar'); + var menubarHidden = menubar && menubar.getAttribute('autohide') == 'true'; + this.window.TabsInTitlebar.allowedBy('TreeStyleTab-menubar', menubarHidden); + }, + initUIShowHideObserver : function TSTWindow_initUIShowHideObserver() { this.rootElementObserver = new BrowserUIShowHideObserver(this, this.document.documentElement); @@ -1042,7 +1053,7 @@ TreeStyleTabWindow.prototype = { } if (TabsInTitlebar) { let allowed = isTopTabbar || utils.getTreePref('toolbox.allowShowInTitlebar'); - TabsInTitlebar.allowedBy('TreeStyleTab', allowed); + TabsInTitlebar.allowedBy('TreeStyleTab-tabsOnTop', allowed); } } finally {