Allow to update the size of the tab bar by other addons with the nsDOMTreeStyleTabTabbarRendered event

This commit is contained in:
YUKI Hiroshi 2015-11-02 16:14:46 +09:00
parent 050a87e108
commit 7e5916cce5
3 changed files with 12 additions and 6 deletions

View File

@ -2086,13 +2086,17 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
else
this.positionPinnedTabsWithDelay(null, null, aReason & this.kTABBAR_UPDATE_BY_AUTOHIDE);
this.notifyingRenderedEvent = true;
var event = d.createEvent('Events');
event.initEvent(this.kEVENT_TYPE_TABBAR_RENDERED, true, false);
this.mTabBrowser.tabContainer.dispatchEvent(event);
if (!collapsed && aReason & this.kTABBAR_UPDATE_BY_AUTOHIDE)
setTimeout((function() {
if (this.browser) // ignore calling after destroyed...
this.notifyingRenderedEvent = false;
if (!collapsed &&
aReason & this.kTABBAR_UPDATE_BY_AUTOHIDE &&
this.browser) // ignore calling after destroyed...
this.scrollToTab(this.browser.selectedTab);
}).bind(this), 0);
},

View File

@ -105,7 +105,9 @@ BrowserUIShowHideObserver.prototype = {
onAttributeModified : function BrowserUIShowHideObserver_onAttributeModified(aMutation, aObserver)
{
if (this.handlingAttrChange)
var TST = this.owner.browser.treeStyleTab;
if (this.handlingAttrChange ||
TST.notifyingRenderedEvent)
return;
var target = aMutation.target;
@ -113,7 +115,6 @@ BrowserUIShowHideObserver.prototype = {
if (target.__treestyletab_mutationObserver_lastState == state)
return;
var TST = this.owner.browser.treeStyleTab;
if (
// ignore modifications of each tab
TST.getTabFromChild(target) ||

View File

@ -84,6 +84,7 @@ FullscreenObserver.prototype = {
onSizeModeChange : function FullscreenObserver_onSizeModeChange()
{
this.updateToolboxPosition();
if (!this.window.gBrowser.treeStyleTab.notifyingRenderedEvent)
this.window.gBrowser.treeStyleTab.updateFloatingTabbar(TreeStyleTabConstants.kTABBAR_UPDATE_BY_WINDOW_RESIZE);
},
updateToolboxPosition : function FullscreenObserver_onSizeModeChange()