Bug 1366473 - Explicitly hide close buttons in background tabs when overflowing. r=florian
authorDão Gottwald <dao@mozilla.com>
Tue, 23 May 2017 12:13:43 +0200
changeset 360156 a8d70b131270b07c448f4f32a888d34c1ac546e0
parent 360155 73035b57365cba0872c107cb7ede9c60f8d762db
child 360157 48baf93a251eb0d2e0c20dd94c059a025b259707
push id31871
push userryanvm@gmail.com
push dateTue, 23 May 2017 22:02:07 +0000
treeherdermozilla-central@545ffce30eac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1366473
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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