Bug 1366473 - Explicitly hide close buttons in background tabs when overflowing. r?florian
Due to adjustTabstrip being called in setTimeout, it may have missed the opportunity to set
the closebuttons attribute before entering overflow mode, which would make all tabs show
their close button while overflowing.
MozReview-Commit-ID: 7tuvNH4lr0
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -2373,16 +2373,19 @@
// When overflowing, new tabs are scrolled into view smoothly, which
// doesn't go well together with the width transition. So we skip the
// transition in that case.
let animate = !aSkipAnimation &&
this.tabContainer.getAttribute("overflow") != "true" &&
Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled");
if (!animate) {
t.setAttribute("fadein", "true");
+
+ // Call _handleNewTab asynchronously as it needs to know if the
+ // new tab is selected.
setTimeout(function(tabContainer) {
tabContainer._handleNewTab(t);
}, 0, this.tabContainer);
}
// invalidate cache
this._visibleTabs = null;
@@ -6010,16 +6013,17 @@
]]></body>
</method>
<method name="adjustTabstrip">
<body><![CDATA[
// If we're overflowing, tab widths don't change anymore, so we can
// return early to avoid flushing layout.
if (this.getAttribute("overflow") == "true") {
+ this.setAttribute("closebuttons", "activetab");
return;
}
let numTabs = this.childNodes.length -
this.tabbrowser._removingTabs.length;
if (numTabs > 2) {
// This is an optimization to avoid layout flushes by calling
// getBoundingClientRect() when we just opened a second tab. In