Bug 1366473 - Explicitly hide close buttons in background tabs when overflowing. r?florian draft
authorDão Gottwald <dao@mozilla.com>
Tue, 23 May 2017 12:13:43 +0200
changeset 582918 61bd6be21df169afbc4608ea6c2ff32e429b31b4
parent 582730 5bc1c758ab57c1885dceab4e7837e58af27b998c
child 629907 0adabb42937f4335719ee9ce8910efa0ac82cc8a
push id60232
push userdgottwald@mozilla.com
push dateTue, 23 May 2017 10:14:05 +0000
reviewersflorian
bugs1366473
milestone55.0a1
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
browser/base/content/tabbrowser.xml
--- 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