Activate "tabs in titlebar" mode only when the menubar is hidden

This commit is contained in:
Piro / YUKI Hiroshi 2013-11-21 00:01:39 +09:00
parent 8b0ce402c3
commit 6fb5b1a0e3
2 changed files with 19 additions and 2 deletions

View File

@ -124,11 +124,17 @@ BrowserUIShowHideObserver.prototype = {
aMutations.forEach(function(aMutation) { aMutations.forEach(function(aMutation) {
if (aMutation.type != 'attributes') if (aMutation.type != 'attributes')
return; return;
if (aTargetElement.id == 'toolbar-menubar' &&
aMutation.attributeName == 'autohide') {
this.owner.updateTabsInTitlebarForMenubar();
return;
}
if (aMutation.attributeName == 'hidden' || if (aMutation.attributeName == 'hidden' ||
aMutation.attributeName == 'collapsed' || aMutation.attributeName == 'collapsed' ||
aMutation.attributeName == 'moz-collapsed' || // Used in full screen mode aMutation.attributeName == 'moz-collapsed' || // Used in full screen mode
aMutation.attributeName == 'disablechrome') aMutation.attributeName == 'disablechrome') {
TST.updateFloatingTabbar(TreeStyleTabConstants.kTABBAR_UPDATE_BY_WINDOW_RESIZE); TST.updateFloatingTabbar(TreeStyleTabConstants.kTABBAR_UPDATE_BY_WINDOW_RESIZE);
}
}, this); }, this);
}, },

View File

@ -387,6 +387,7 @@ TreeStyleTabWindow.prototype = {
this.processRestoredTabs(); this.processRestoredTabs();
this.updateTabsOnTop(); this.updateTabsOnTop();
this.updateTabsInTitlebarForMenubar();
// Init autohide service only if it have to be activated. // Init autohide service only if it have to be activated.
if (this.isAutoHide) if (this.isAutoHide)
@ -451,6 +452,16 @@ TreeStyleTabWindow.prototype = {
}, this); }, 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() initUIShowHideObserver : function TSTWindow_initUIShowHideObserver()
{ {
this.rootElementObserver = new BrowserUIShowHideObserver(this, this.document.documentElement); this.rootElementObserver = new BrowserUIShowHideObserver(this, this.document.documentElement);
@ -1042,7 +1053,7 @@ TreeStyleTabWindow.prototype = {
} }
if (TabsInTitlebar) { if (TabsInTitlebar) {
let allowed = isTopTabbar || utils.getTreePref('toolbox.allowShowInTitlebar'); let allowed = isTopTabbar || utils.getTreePref('toolbox.allowShowInTitlebar');
TabsInTitlebar.allowedBy('TreeStyleTab', allowed); TabsInTitlebar.allowedBy('TreeStyleTab-tabsOnTop', allowed);
} }
} }
finally { finally {