split destroying/reinitializing process from event listener methods
This commit is contained in:
parent
41084ec097
commit
0b8a4070c5
@ -1529,6 +1529,70 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
syncDestroyTabbar : function TSTBrowser_syncDestroyTabbar()
|
||||||
|
{
|
||||||
|
if (this.currentTabbarPosition != 'top') {
|
||||||
|
this._lastTabbarPositionBeforeDestroyed = this.currentTabbarPosition;
|
||||||
|
let self = this;
|
||||||
|
this.doAndWaitDOMEvent(
|
||||||
|
this.kEVENT_TYPE_TABBAR_POSITION_CHANGED,
|
||||||
|
window,
|
||||||
|
100,
|
||||||
|
function() { self.currentTabbarPosition = 'top'; }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.isFixed) {
|
||||||
|
this._lastTabbarFixedBeforeDestroyed = this.isFixed;
|
||||||
|
let self = this;
|
||||||
|
this.doAndWaitDOMEvent(
|
||||||
|
this.kEVENT_TYPE_TABBAR_STATE_CHANGED,
|
||||||
|
window,
|
||||||
|
100,
|
||||||
|
function() { self.toggleFixed(); }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateFloatingTabbar(this.kTABBAR_UPDATE_NOW);
|
||||||
|
this.removeTabStripAttribute('width');
|
||||||
|
this.removeTabStripAttribute('height');
|
||||||
|
this.removeTabStripAttribute('ordinal');
|
||||||
|
|
||||||
|
this.mTabBrowser.mTabContainer.parentNode.classList.remove(this.kTABBAR_TOOLBAR);
|
||||||
|
},
|
||||||
|
|
||||||
|
syncReinitTabbar : function TSTBrowser_syncReinitTabbar()
|
||||||
|
{
|
||||||
|
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(
|
||||||
|
this.kEVENT_TYPE_TABBAR_INITIALIZED,
|
||||||
|
window,
|
||||||
|
100,
|
||||||
|
function() {
|
||||||
|
self.initTabbar(self._lastTabbarPositionBeforeDestroyed, 'top');
|
||||||
|
delete self._lastTabbarPositionBeforeDestroyed;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.updateFloatingTabbar(this.kTABBAR_UPDATE_NOW);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
destroy : function TSTBrowser_destroy()
|
destroy : function TSTBrowser_destroy()
|
||||||
{
|
{
|
||||||
this.saveTreeStructure();
|
this.saveTreeStructure();
|
||||||
@ -3278,68 +3342,12 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
onToolbarCustomizeStart : function TSTBrowser_onToolbarCustomizeStart(aEvent)
|
onToolbarCustomizeStart : function TSTBrowser_onToolbarCustomizeStart(aEvent)
|
||||||
{
|
{
|
||||||
return;
|
this.syncDestroyTabbar();
|
||||||
if (this.currentTabbarPosition != 'top') {
|
|
||||||
this._lastTabbarPositionBeforeCustomizing = this.currentTabbarPosition;
|
|
||||||
let self = this;
|
|
||||||
this.waitForDOMEvent(
|
|
||||||
this.kEVENT_TYPE_TABBAR_POSITION_CHANGED,
|
|
||||||
window,
|
|
||||||
100,
|
|
||||||
function() { self.currentTabbarPosition = 'top'; }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.isFixed) {
|
|
||||||
this._lastTabbarFixedBeforeCustomizing = this.isFixed;
|
|
||||||
let self = this;
|
|
||||||
this.waitForDOMEvent(
|
|
||||||
this.kEVENT_TYPE_TABBAR_STATE_CHANGED,
|
|
||||||
window,
|
|
||||||
100,
|
|
||||||
function() { self.toggleFixed(); }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateFloatingTabbar(this.kTABBAR_UPDATE_NOW);
|
|
||||||
this.removeTabStripAttribute('width');
|
|
||||||
this.removeTabStripAttribute('height');
|
|
||||||
this.removeTabStripAttribute('ordinal');
|
|
||||||
|
|
||||||
this.mTabBrowser.mTabContainer.parentNode.classList.remove(this.kTABBAR_TOOLBAR);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onToolbarCustomizeEnd : function TSTBrowser_onToolbarCustomizeEnd(aEvent)
|
onToolbarCustomizeEnd : function TSTBrowser_onToolbarCustomizeEnd(aEvent)
|
||||||
{
|
{
|
||||||
return;
|
this.syncReinitTabbar();
|
||||||
this.mTabBrowser.mTabContainer.parentNode.classList.add(this.kTABBAR_TOOLBAR);
|
|
||||||
|
|
||||||
if (!this._lastTabbarFixedBeforeCustomizing && this.isFixed) {
|
|
||||||
let self = this;
|
|
||||||
this.waitForDOMEvent(
|
|
||||||
this.kEVENT_TYPE_TABBAR_STATE_CHANGED,
|
|
||||||
window,
|
|
||||||
100,
|
|
||||||
function() {
|
|
||||||
self.toggleFixed();
|
|
||||||
delete self._lastTabbarFixedBeforeCustomizing;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._lastTabbarPositionBeforeCustomizing) {
|
|
||||||
let self = this;
|
|
||||||
this.waitForDOMEvent(
|
|
||||||
this.kEVENT_TYPE_TABBAR_INITIALIZED,
|
|
||||||
window,
|
|
||||||
100,
|
|
||||||
function() {
|
|
||||||
self.initTabbar(self._lastTabbarPositionBeforeCustomizing, 'top');
|
|
||||||
delete self._lastTabbarPositionBeforeCustomizing;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
this.updateFloatingTabbar(this.kTABBAR_UPDATE_NOW);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onToolbarCustomizeChanging : function TSTBrowser_onToolbarCustomizeChanging(aEvent)
|
onToolbarCustomizeChanging : function TSTBrowser_onToolbarCustomizeChanging(aEvent)
|
||||||
|
@ -560,7 +560,7 @@ var TreeStyleTabUtils = {
|
|||||||
kUNDO_CLOSE_SET : 2,
|
kUNDO_CLOSE_SET : 2,
|
||||||
kUNDO_CLOSE_FULL_SET : 256,
|
kUNDO_CLOSE_FULL_SET : 256,
|
||||||
|
|
||||||
waitForDOMEvent : function TSTUtils_waitForDOMEvent()
|
doAndWaitDOMEvent : function TSTUtils_doAndWaitDOMEvent()
|
||||||
{
|
{
|
||||||
var type, target, delay, task;
|
var type, target, delay, task;
|
||||||
Array.slice(arguments).forEach(function(aArg) {
|
Array.slice(arguments).forEach(function(aArg) {
|
||||||
|
Loading…
Reference in New Issue
Block a user