When the tab bar is moved into the title bar, show/hide menu bar breaks the tab bar.

This commit is contained in:
Piro / SHIMODA Hiroshi 2011-01-23 02:18:03 +09:00
parent 4f6ffd80e8
commit 4fbfd750d2
2 changed files with 46 additions and 9 deletions

View File

@ -1210,33 +1210,57 @@ TreeStyleTabService.overrideExtensionsDelayed = function TSTService_overrideExte
// Personal Titlebar
// https://addons.mozilla.org/irefox/addon/personal-titlebar/
if (document.getElementById('personal-titlebar')) {
let titlebar = document.getElementById('titlebar');
let personalTitlebar = document.getElementById('personal-titlebar');
let listener = {
handleEvent : function(aEvent)
{
switch (aEvent.type)
{
case 'beforecustomization':
let (bar = document.getElementById('personal-titlebar')) {
bar.classList.remove(TreeStyleTabService.kTABBAR_TOOLBAR);
bar.style.top = '';
bar.style.left = '';
bar.style.width = '';
bar.style.height = '';
bar.removeAttribute('height');
bar.removeAttribute('width');
bar.removeAttribute('ordinal');
titlebar.removeEventListener('DOMAttrModified', this, true);
personalTitlebar.classList.remove(TreeStyleTabService.kTABBAR_TOOLBAR);
personalTitlebar.style.top = '';
personalTitlebar.style.left = '';
personalTitlebar.style.width = '';
personalTitlebar.style.height = '';
personalTitlebar.removeAttribute('height');
personalTitlebar.removeAttribute('width');
personalTitlebar.removeAttribute('ordinal');
break;
case 'aftercustomization':
titlebar.addEventListener('DOMAttrModified', this, true);
break;
case 'DOMAttrModified':
if (
aEvent.attrName == 'hidden' &&
gBrowser.tabContainer.parentNode.id == (aEvent.newValue == 'true' ? 'toolbar-menubar' : 'personal-titlebar' )
) {
TreeStyleTabService.stopRendering();
gBrowser.treeStyleTab.syncDestroyTabbar();
window.setTimeout(function() {
gBrowser.treeStyleTab.syncReinitTabbar();
TreeStyleTabService.startRendering();
}, 0);
}
break;
case 'unload':
titlebar.removeEventListener('DOMAttrModified', this, true);
window.removeEventListener('beforecustomization', this, false);
window.removeEventListener('aftercustomization', this, false);
window.removeEventListener('unload', this, false);
personalTitlebar = null;
break;
}
}
};
window.addEventListener('beforecustomization', listener, false);
window.addEventListener('aftercustomization', listener, false);
window.addEventListener('unload', listener, false);
titlebar.addEventListener('DOMAttrModified', listener, true);
}
// Firefox Sync (Weave)

View File

@ -1577,6 +1577,8 @@ TreeStyleTabBrowser.prototype = {
syncReinitTabbar : function TSTBrowser_syncReinitTabbar()
{
this.stopRendering();
this.mTabBrowser.mTabContainer.parentNode.classList.add(this.kTABBAR_TOOLBAR);
var position = this._lastTabbarPositionBeforeDestroyed || this.position;
@ -1594,6 +1596,8 @@ TreeStyleTabBrowser.prototype = {
this.reinitAllTabs(true);
this.tabbarDNDObserver.startListenEvents();
this.startRendering();
},
destroy : function TSTBrowser_destroy()
@ -1697,6 +1701,8 @@ TreeStyleTabBrowser.prototype = {
syncDestroyTabbar : function TSTBrowser_syncDestroyTabbar()
{
this.stopRendering();
this._lastTabbarPositionBeforeDestroyed = this.position;
if (this.position != 'top') {
let self = this;
@ -1712,6 +1718,11 @@ TreeStyleTabBrowser.prototype = {
if (!this.fixed) this.fixed = true;
var tabbar = this.mTabBrowser.tabContainer;
tabbar.removeAttribute('width');
tabbar.removeAttribute('height');
tabbar.removeAttribute('ordinal');
this.removeTabStripAttribute('width');
this.removeTabStripAttribute('height');
this.removeTabStripAttribute('ordinal');
@ -1721,6 +1732,8 @@ TreeStyleTabBrowser.prototype = {
this.tabbarDNDObserver.endListenEvents();
this.mTabBrowser.mTabContainer.parentNode.classList.remove(this.kTABBAR_TOOLBAR);
this.startRendering();
},
saveCurrentState : function TSTBrowser_saveCurrentState()