Bug 1606681 - Port |Bug 752376 - Avoid calling scrollbox.ensureElementIsVisible() if the tab strip doesn't overflow to prevent layout flushes| and |Bug 1357064 - Reducing the width of the window while the last tab is selected shouldn't causes the tabstrip to animate| to SeaMonkey. r=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Sun, 05 Jan 2020 22:10:31 +0100
changeset 37195 652e57af2d8a502d8f30faa53e7cb9f90b4510cc
parent 37194 000158b2aa701f94ae4b73ff88855a7d1d737237
child 37196 8fb15a65ede6fcb26558a71f8f5416640a40cff0
push id2552
push userclokep@gmail.com
push dateMon, 10 Feb 2020 21:24:16 +0000
treeherdercomm-beta@f95a6f4408a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg
bugs1606681, 752376, 1357064
Bug 1606681 - Port |Bug 752376 - Avoid calling scrollbox.ensureElementIsVisible() if the tab strip doesn't overflow to prevent layout flushes| and |Bug 1357064 - Reducing the width of the window while the last tab is selected shouldn't causes the tabstrip to animate| to SeaMonkey. r=frg
suite/browser/tabbrowser.xml
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -2483,17 +2483,17 @@
 
             this.mCurrentTab._selected = false;
 
             if (aDestIndex >= aSrcIndex)
               ++aDestIndex;
             var tab = this.tabContainer.insertBefore(this.tabs[aSrcIndex], this.tabs.item(aDestIndex));
 
             this.mCurrentTab._selected = true;
-            this.tabContainer.arrowScrollbox.ensureElementIsVisible(this.mCurrentTab, false);
+            this.tabContainer._handleTabSelect(false);
 
             tab.dispatchEvent(new UIEvent("TabMove",
               { bubbles: true, cancelable: false, view: window,
                 detail: aSrcIndex }));
           ]]>
         </body>
       </method>
 
@@ -3234,17 +3234,17 @@
       </handler>
       <handler event="overflow">
         <![CDATA[
            if (event.detail == 0)
              return; // Ignore vertical events
 
            var tabs = document.getBindingParent(this);
            tabs.setAttribute("overflow", true);
-           this.ensureElementIsVisible(tabs.selectedItem, false);
+           tabs._handleTabSelect(false);
         ]]>
       </handler>
     </handlers>
   </binding>
 
   <binding id="tabbrowser-tabs"
            extends="chrome://global/content/bindings/tabbox.xml#tabs">
     <content>
@@ -3315,36 +3315,39 @@
 
       <field name="arrowScrollboxWidth">0</field>
 
       <field name="arrowScrollbox">
         document.getAnonymousElementByAttribute(this, "anonid", "arrowscrollbox");
       </field>
 
       <method name="_handleTabSelect">
+        <parameter name="aSmoothScroll"/>
         <body>
           <![CDATA[
-            this.arrowScrollbox.ensureElementIsVisible(this.selectedItem);
+            if (this.getAttribute("overflow") == "true")
+              this.arrowScrollbox.ensureElementIsVisible(this.selectedItem,
+                                                         aSmoothScroll);
           ]]>
         </body>
       </method>
 
       <method name="handleEvent">
         <parameter name="aEvent"/>
         <body>
           <![CDATA[
             switch (aEvent.type)
             {
               case "resize":
                 if (aEvent.target != window)
                   break;
                 var width = this.arrowScrollbox.boxObject.width;
                 if (width != this.arrowScrollboxWidth)
                 {
-                  this._handleTabSelect();
+                  this._handleTabSelect(false);
                   this.arrowScrollboxWidth = width;
                 }
                 break;
             }
           ]]>
         </body>
       </method>