Bug 1302737 - When closing tabs with non-mouse devices (e.g. touch, pen), don't enter locked-tab-size mode. r?Gijs draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 27 Sep 2016 13:29:19 -0400
changeset 418075 be76c1a594098795e0559e647f1112a57bfc35c5
parent 418074 bad907128e14038fd7a9bd95a3f9fa5fcb9b738a
child 532251 0a278e6ebb6456d59184e76df99348c6a2f41cc3
push id30580
push userkgupta@mozilla.com
push dateTue, 27 Sep 2016 17:30:01 +0000
reviewersGijs
bugs1302737
milestone52.0a1
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: 3cJNAQWIOgp
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -5971,17 +5971,18 @@
         }
       ]]></handler>
 
       <handler event="click"><![CDATA[
         if (event.button != 1)
           return;
 
         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.
@@ -6393,17 +6394,18 @@
        element (in both cases, when they are anonymous nodes of <tabbrowser>).
   -->
   <binding id="tabbrowser-close-tab-button"
            extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-image">
     <handlers>
       <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>
 
       <handler event="dblclick" button="0" phase="capturing">
         // for the one-close-button case
         event.stopPropagation();