Disable "TabsInTitlebar" if tabs are not on the top

This commit is contained in:
Piro / YUKI Hiroshi 2013-11-19 23:23:25 +09:00
parent 334dd585b5
commit 1b4eb1cd8a

View File

@ -1006,38 +1006,41 @@ TreeStyleTabWindow.prototype = {
updateTabsOnTop : function TSTWindow_updateTabsOnTop() updateTabsOnTop : function TSTWindow_updateTabsOnTop()
{ {
var w = this.window;
if ( if (
this.isPopupWindow || this.isPopupWindow ||
this.tabsOnTopChangingByUI || this.tabsOnTopChangingByUI ||
this.tabsOnTopChangingByTST || this.tabsOnTopChangingByTST
!('TabsOnTop' in w) ||
!('enabled' in w.TabsOnTop)
) )
return; return;
var TabsOnTop = this.window.TabsOnTop;
var TabsInTitlebar = this.window.TabsInTitlebar;
var isTopTabbar = this.browser.treeStyleTab.position == 'top';
this.tabsOnTopChangingByTST = true; this.tabsOnTopChangingByTST = true;
try { try {
var TabsOnTop = w.TabsOnTop; if (TabsOnTop) {
var originalState = utils.getTreePref('tabsOnTop.originalState'); let originalState = utils.getTreePref('tabsOnTop.originalState');
if (originalState === null) { if (originalState === null) {
let current = prefs.getDefaultPref('browser.tabs.onTop') === null ? let current = prefs.getDefaultPref('browser.tabs.onTop') === null ?
TabsOnTop.enabled : TabsOnTop.enabled :
prefs.getPref('browser.tabs.onTop') ; prefs.getPref('browser.tabs.onTop') ;
utils.setTreePref('tabsOnTop.originalState', originalState = current); utils.setTreePref('tabsOnTop.originalState', originalState = current);
} }
if (this.browser.treeStyleTab.position != 'top' || if (!isTopTabbar || !this.browser.treeStyleTab.fixed) {
!this.browser.treeStyleTab.fixed) { if (TabsOnTop.enabled)
if (TabsOnTop.enabled) TabsOnTop.enabled = false;
TabsOnTop.enabled = false; }
} else {
else { if (TabsOnTop.enabled != originalState)
if (TabsOnTop.enabled != originalState) TabsOnTop.enabled = originalState;
TabsOnTop.enabled = originalState; utils.clearTreePref('tabsOnTop.originalState');
utils.clearTreePref('tabsOnTop.originalState'); }
} }
if (TabsInTitlebar)
TabsInTitlebar.allowedBy('TreeStyleTab', isTopTabbar);
} }
finally { finally {
this.tabsOnTopChangingByTST = false; this.tabsOnTopChangingByTST = false;