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
--- 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();