Bug 1302737 - When closing tabs with non-mouse devices (e.g. touch, pen), don't enter locked-tab-size mode. r=Gijs
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 29 Sep 2016 10:05:25 -0400
changeset 315844 f2bac20c2f7644e0432713aa9bc2b55dfcc6a1f4
parent 315843 4d39febef604b36a675216cfa5cb605a8189d212
child 315845 9e9080a2e3462fc576b679603853f4395fadff8f
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Bug 1302737 - When closing tabs with non-mouse devices (e.g. touch, pen), don't enter locked-tab-size mode. r=Gijs The problem with entering this mode with touch input is that there's no obvious time to exit the mode. If the user taps on the tab-close button and then lifts their finger, they might want to close more tabs or they might want to do something else. For touch/pen, we don't get events like mousemove/mouseout to distinguish between the two cases. Using a timeout is one possibility but for now it seems safer to simply not enter that mode when the user is using touch input to close tabs. MozReview-Commit-ID: FR0bMmLArQ5
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -5987,17 +5987,18 @@
       <handler event="click"><![CDATA[
         if (event.button != 1)
         if (event.target.localName == "tab") {
-          this.tabbrowser.removeTab(event.target, {animate: true, byMouse: true});
+          this.tabbrowser.removeTab(event.target, {animate: true,
+                byMouse: event.mozInputSource == MouseEvent.MOZ_SOURCE_MOUSE});
         } else if (event.originalTarget.localName == "box") {
           // The user middleclicked an open space on the tabstrip. This could
           // be because they intend to open a new tab, but it could also be
           // because they just removed a tab and they now middleclicked on the
           // resulting space while that tab is closing. In that case, we don't
           // want to open a tab. So if we're removing one or more tabs, and
           // the tab click is before the end of the last visible tab, we do
           // nothing.
@@ -6409,17 +6410,18 @@
        element (in both cases, when they are anonymous nodes of <tabbrowser>).
   <binding id="tabbrowser-close-tab-button"
       <handler event="click" button="0"><![CDATA[
         var bindingParent = document.getBindingParent(this);
         var tabContainer = bindingParent.parentNode;
-        tabContainer.tabbrowser.removeTab(bindingParent, {animate: true, byMouse: true});
+        tabContainer.tabbrowser.removeTab(bindingParent, {animate: true,
+                byMouse: event.mozInputSource == MouseEvent.MOZ_SOURCE_MOUSE});
         // This enables double-click protection for the tab container
         // (see tabbrowser-tabs 'click' handler).
         tabContainer._blockDblClick = true;
       <handler event="dblclick" button="0" phase="capturing">
         // for the one-close-button case