Bug 734273 - tab bar sometimes shows scroll arrows with only one tab after startup. r=felipe

- delayed updateVisibility to the load event since the constructor runs earlier

- added _propagatedVisibilityOnce instead of unconditionally calling _propagateVisibility after calling updateVisibility for the first time, since this needlessly propagated the visibility twice in a row with browser.tabs.autoHide = false

- removed the syncUI call from TabsOnTop.init since updateVisibility takes care of this
This commit is contained in:
Dão Gottwald 2012-03-12 01:59:33 +01:00
parent 5368eb806b
commit 24a7a36707
2 changed files with 9 additions and 9 deletions

View File

@ -5331,8 +5331,6 @@ function setToolbarVisibility(toolbar, isVisible) {
var TabsOnTop = {
init: function TabsOnTop_init() {
this._initialized = true;
this.syncUI();
Services.prefs.addObserver(this._prefName, this, false);
},
@ -5345,9 +5343,6 @@ var TabsOnTop = {
},
syncUI: function () {
if (!this._initialized)
return;
let userEnabled = Services.prefs.getBoolPref(this._prefName);
let enabled = userEnabled && gBrowser.tabContainer.visible;

View File

@ -2779,9 +2779,7 @@
Services.prefs.addObserver("browser.tabs.", this._prefObserver, false);
window.addEventListener("resize", this, false);
this.updateVisibility();
this._propagateVisibility();
window.addEventListener("load", this, false);
]]>
</constructor>
@ -2841,15 +2839,19 @@
this.parentNode && this.parentNode.localName == "toolbar" ? this.parentNode : this;
]]></field>
<field name="_propagatedVisibilityOnce">false</field>
<property name="visible"
onget="return !this._container.collapsed;">
<setter><![CDATA[
if (val == this.visible)
if (val == this.visible &&
this._propagatedVisibilityOnce)
return val;
this._container.collapsed = !val;
this._propagateVisibility();
this._propagatedVisibilityOnce = true;
return val;
]]></setter>
@ -3080,6 +3082,9 @@
<parameter name="aEvent"/>
<body><![CDATA[
switch (aEvent.type) {
case "load":
this.updateVisibility();
break;
case "resize":
if (aEvent.target != window)
break;