the orient of the tab bar was wrongly recognized when sycnReinitiTabbar.

This commit is contained in:
Piro / SHIMODA Hiroshi 2011-01-22 23:43:55 +09:00
parent 06d15a8e8d
commit 5ba83972c4
3 changed files with 50 additions and 45 deletions

View File

@ -1231,7 +1231,7 @@ var TreeStyleTabService = {
this._tabsOnTopDefaultState = TabsOnTop.enabled;
if (gBrowser.treeStyleTab.currentTabbarPosition != 'top' ||
!gBrowser.treeStyleTab.isFixed) {
!gBrowser.treeStyleTab.fixed) {
if (TabsOnTop.enabled)
TabsOnTop.enabled = false;
}
@ -1359,7 +1359,8 @@ var TreeStyleTabService = {
var orient = b.treeStyleTab.isVertical ? 'vertical' : 'horizontal' ;
var newFixed = b.getAttribute(this.kFIXED+'-'+orient) != 'true';
this.setTabbrowserAttribute(this.kFIXED+'-'+orient, newFixed ? 'true' : null, b);
this.setTabbrowserAttribute(this.kFIXED+'-'+orient, newFixed || null, this.mTabBrowser);
b.treeStyleTab.fixed = newFixed;
this.setTreePref('tabbar.fixed.'+orient, newFixed);
b.treeStyleTab.updateTabbarState();

View File

@ -151,6 +151,10 @@ TreeStyleTabBrowser.prototype = {
var b = this.mTabBrowser;
if (!b) return false;
if (b.hasAttribute(this.kMODE))
return b.getAttribute(this.kMODE) == 'vertical';
var box = this.scrollBox || b.mTabContainer ;
return (box.getAttribute('orient') || window.getComputedStyle(box, '').getPropertyValue('-moz-box-orient')) == 'vertical';
},
@ -160,7 +164,7 @@ TreeStyleTabBrowser.prototype = {
return this._tabStripPlaceHolder;
},
get isFixed()
get fixed()
{
var orient = this.isVertical ? 'vertical' : 'horizontal' ;
if (!this.preInitialized)
@ -170,6 +174,15 @@ TreeStyleTabBrowser.prototype = {
if (!b) return false;
return b.getAttribute(this.kFIXED+'-'+orient) == 'true';
},
set fixed(aValue)
{
this.setTabbrowserAttribute(this.kFIXED, aValue || null, this.mTabBrowser);
return aValue;
},
get isFixed() // for backward compatibility
{
return this.fixed;
},
get canStackTabs()
{
@ -1171,14 +1184,14 @@ TreeStyleTabBrowser.prototype = {
var toggleTabsOnTop = document.getElementById('cmd_ToggleTabsOnTop');
if (this.isVertical) {
orient = 'vertical';
this.setTabbrowserAttribute(this.kFIXED, this.isFixed ? 'true' : null , b);
this.fixed = this.fixed; // ensure set to the current orient
if (toggleTabsOnTop)
toggleTabsOnTop.setAttribute('disabled', true);
}
else {
orient = 'horizontal';
if (this.isFixed) {
this.setTabbrowserAttribute(this.kFIXED, true, b);
if (this.fixed) {
this.fixed = true; // ensure set to the current orient
if (!this.isMultiRow()) {
this.removeTabStripAttribute('height');
b.mPanelContainer.removeAttribute('height');
@ -1196,7 +1209,7 @@ TreeStyleTabBrowser.prototype = {
}
}
else {
this.removeTabbrowserAttribute(this.kFIXED, b);
this.fixed = false; // ensure set to the current orient
this.setTabStripAttribute('height', this.maxTabbarHeight(this.getTreePref('tabbar.height'), b));
}
if (toggleTabsOnTop) {
@ -1208,7 +1221,7 @@ TreeStyleTabBrowser.prototype = {
}
if ('TabsOnTop' in window)
TabsOnTop.enabled = TabsOnTop.enabled && this.currentTabbarPosition == 'top' && this.isFixed;
TabsOnTop.enabled = TabsOnTop.enabled && this.currentTabbarPosition == 'top' && this.fixed;
window.setTimeout(function(aSelf) {
aSelf.updateFloatingTabbar(aSelf.kTABBAR_UPDATE_BY_APPEARANCE_CHANGE);
@ -1236,7 +1249,7 @@ TreeStyleTabBrowser.prototype = {
var b = this.mTabBrowser;
var orient = this.isVertical ? 'vertical' : 'horizontal' ;
var oldState = {
fixed : this.isFixed,
fixed : this.fixed,
maxTreeLevel : this.maxTreeLevel,
indented : this.maxTreeLevel != 0,
canCollapse : b.getAttribute(this.kALLOW_COLLAPSE) == 'true'
@ -1280,7 +1293,7 @@ TreeStyleTabBrowser.prototype = {
{
var b = this.mTabBrowser;
var state = {
fixed : this.isFixed,
fixed : this.fixed,
maxTreeLevel : this.maxTreeLevel,
indented : this.maxTreeLevel != 0,
canCollapse : b.getAttribute(this.kALLOW_COLLAPSE) == 'true'
@ -1501,19 +1514,6 @@ TreeStyleTabBrowser.prototype = {
{
this.mTabBrowser.mTabContainer.parentNode.classList.add(this.kTABBAR_TOOLBAR);
if (!this._lastTabbarFixedBeforeDestroyed && this.isFixed) {
let self = this;
this.doAndWaitDOMEvent(
this.kEVENT_TYPE_TABBAR_STATE_CHANGED,
window,
100,
function() {
self.toggleFixed();
delete self._lastTabbarFixedBeforeDestroyed;
}
);
}
if (this._lastTabbarPositionBeforeDestroyed) {
let self = this;
this.doAndWaitDOMEvent(
@ -1522,11 +1522,12 @@ TreeStyleTabBrowser.prototype = {
100,
function() {
self.initTabbar(self._lastTabbarPositionBeforeDestroyed, 'top');
delete self._lastTabbarPositionBeforeDestroyed;
}
);
this.updateFloatingTabbar(this.kTABBAR_UPDATE_NOW);
delete this._lastTabbarPositionBeforeDestroyed;
}
this.tabbarDNDObserver.startListenEvents();
},
destroy : function TSTBrowser_destroy()
@ -1641,16 +1642,8 @@ TreeStyleTabBrowser.prototype = {
);
}
if (!this.isFixed) {
this._lastTabbarFixedBeforeDestroyed = this.isFixed;
let self = this;
this.doAndWaitDOMEvent(
this.kEVENT_TYPE_TABBAR_STATE_CHANGED,
window,
100,
function() { self.toggleFixed(); }
);
}
if (!this.fixed)
this.fixed = true;
this.updateFloatingTabbar(this.kTABBAR_UPDATE_NOW);
this.removeTabStripAttribute('width');
@ -1658,6 +1651,8 @@ TreeStyleTabBrowser.prototype = {
this.removeTabStripAttribute('ordinal');
this._endListenTabbarEvents();
this.tabbarDNDObserver.endListenEvents();
this.mTabBrowser.mTabContainer.parentNode.classList.remove(this.kTABBAR_TOOLBAR);
},
@ -3562,7 +3557,7 @@ TreeStyleTabBrowser.prototype = {
if (
!aEnabled ||
this.currentTabbarPosition != 'top' ||
this.isFixed
this.fixed
)
return;
window.setTimeout(function(aTabBrowser) {

View File

@ -1119,7 +1119,11 @@ catch(e) {
this.mAutoExpandTimer = null;
this.mAutoExpandedTabs = [];
this.startListenEvents();
},
startListenEvents : function TabbarDND_startListenEvents()
{
var strip = this.treeStyleTab.tabStrip;
strip.addEventListener('dragstart', this, true);
strip.addEventListener('dragover', this, true);
@ -1130,6 +1134,16 @@ catch(e) {
},
destroy : function TabbarDND_destroy()
{
this.endListenEvents();
delete this.treeStyleTab;
delete this.browser;
delete this.document;
delete this.window;
},
endListenEvents : function TabbarDND_endListenEvents()
{
var strip = this.treeStyleTab.tabStrip;
strip.removeEventListener('dragstart', this, true);
@ -1138,11 +1152,6 @@ catch(e) {
strip.removeEventListener('dragleave', this, false);
strip.removeEventListener('dragend', this, false);
strip.removeEventListener('drop', this, true);
delete this.treeStyleTab;
delete this.browser;
delete this.document;
delete this.window;
}
};