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) {
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);
},

View File

@ -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 {