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,15 +2086,19 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
else else
this.positionPinnedTabsWithDelay(null, null, aReason & this.kTABBAR_UPDATE_BY_AUTOHIDE); this.positionPinnedTabsWithDelay(null, null, aReason & this.kTABBAR_UPDATE_BY_AUTOHIDE);
this.notifyingRenderedEvent = true;
var event = d.createEvent('Events'); var event = d.createEvent('Events');
event.initEvent(this.kEVENT_TYPE_TABBAR_RENDERED, true, false); event.initEvent(this.kEVENT_TYPE_TABBAR_RENDERED, true, false);
this.mTabBrowser.tabContainer.dispatchEvent(event); this.mTabBrowser.tabContainer.dispatchEvent(event);
if (!collapsed && aReason & this.kTABBAR_UPDATE_BY_AUTOHIDE) setTimeout((function() {
setTimeout((function() { this.notifyingRenderedEvent = false;
if (this.browser) // ignore calling after destroyed...
if (!collapsed &&
aReason & this.kTABBAR_UPDATE_BY_AUTOHIDE &&
this.browser) // ignore calling after destroyed...
this.scrollToTab(this.browser.selectedTab); this.scrollToTab(this.browser.selectedTab);
}).bind(this), 0); }).bind(this), 0);
}, },
getTabbarPlaceholderSize: function TSTBrowser_getTabbarPlaceholderSize() getTabbarPlaceholderSize: function TSTBrowser_getTabbarPlaceholderSize()
{ {

View File

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

View File

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