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 // Personal Titlebar
// https://addons.mozilla.org/irefox/addon/personal-titlebar/ // https://addons.mozilla.org/irefox/addon/personal-titlebar/
if (document.getElementById('personal-titlebar')) { if (document.getElementById('personal-titlebar')) {
let titlebar = document.getElementById('titlebar');
let personalTitlebar = document.getElementById('personal-titlebar');
let listener = { let listener = {
handleEvent : function(aEvent) handleEvent : function(aEvent)
{ {
switch (aEvent.type) switch (aEvent.type)
{ {
case 'beforecustomization': case 'beforecustomization':
let (bar = document.getElementById('personal-titlebar')) { titlebar.removeEventListener('DOMAttrModified', this, true);
bar.classList.remove(TreeStyleTabService.kTABBAR_TOOLBAR); personalTitlebar.classList.remove(TreeStyleTabService.kTABBAR_TOOLBAR);
bar.style.top = ''; personalTitlebar.style.top = '';
bar.style.left = ''; personalTitlebar.style.left = '';
bar.style.width = ''; personalTitlebar.style.width = '';
bar.style.height = ''; personalTitlebar.style.height = '';
bar.removeAttribute('height'); personalTitlebar.removeAttribute('height');
bar.removeAttribute('width'); personalTitlebar.removeAttribute('width');
bar.removeAttribute('ordinal'); 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; break;
case 'unload': case 'unload':
titlebar.removeEventListener('DOMAttrModified', this, true);
window.removeEventListener('beforecustomization', this, false); window.removeEventListener('beforecustomization', this, false);
window.removeEventListener('aftercustomization', this, false);
window.removeEventListener('unload', this, false); window.removeEventListener('unload', this, false);
personalTitlebar = null;
break; break;
} }
} }
}; };
window.addEventListener('beforecustomization', listener, false); window.addEventListener('beforecustomization', listener, false);
window.addEventListener('aftercustomization', listener, false);
window.addEventListener('unload', listener, false); window.addEventListener('unload', listener, false);
titlebar.addEventListener('DOMAttrModified', listener, true);
} }
// Firefox Sync (Weave) // Firefox Sync (Weave)

View File

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