Bug 1429929 - Remove tabbrowser-close-tab-button binding. r?gijs
MozReview-Commit-ID: 3bIccSfVMuJ
--- a/browser/base/content/tabbrowser.css
+++ b/browser/base/content/tabbrowser.css
@@ -5,20 +5,16 @@
.tabbrowser-tabpanels {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-tabpanels");
}
.tabbrowser-arrowscrollbox {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-arrowscrollbox");
}
-.tab-close-button {
- -moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-close-tab-button");
-}
-
.tab-close-button[pinned],
#tabbrowser-tabs[closebuttons="activetab"] > .tabbrowser-tab > .tab-stack > .tab-content > .tab-close-button:not([selected="true"]),
.tab-icon-image:not([src]):not([pinned]):not([crashed])[selected],
.tab-icon-image:not([src]):not([pinned]):not([crashed]):not([sharing]),
.tab-icon-image[busy],
.tab-throbber:not([busy]),
.tab-throbber-fallback:not([busy]),
.tab-icon-sound:not([soundplaying]):not([muted]):not([activemedia-blocked]),
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -7205,17 +7205,16 @@
// as double-clicking the titlebar
if (TabsInTitlebar.enabled || this.parentNode._dragBindingAlive)
return;
if (event.button != 0 ||
event.originalTarget.localName != "box")
return;
- // See hack note in the tabbrowser-close-tab-button binding
if (!this._blockDblClick)
BrowserOpenTab();
event.preventDefault();
]]></handler>
<handler event="click" button="0" phase="capturing"><![CDATA[
/* Catches extra clicks meant for the in-tab close button.
@@ -7254,18 +7253,17 @@
}
}
/* Protects from close-tab-button errant doubleclick:
* Since we're removing the event target, if the user
* double-clicks the button, the dblclick event will be dispatched
* with the tabbar as its event target (and explicit/originalTarget),
* which treats that as a mouse gesture for opening a new tab.
- * In this context, we're manually blocking the dblclick event
- * (see tabbrowser-close-tab-button dblclick handler).
+ * In this context, we're manually blocking the dblclick event.
*/
if (this._blockDblClick) {
if (!("_clickedTabBarOnce" in this)) {
this._clickedTabBarOnce = true;
return;
}
delete this._clickedTabBarOnce;
this._blockDblClick = false;
@@ -7736,44 +7734,16 @@
return;
this._tabDropIndicator.collapsed = true;
event.stopPropagation();
]]></handler>
</handlers>
</binding>
- <!-- close-tab-button binding
- This binding relies on the structure of the tabbrowser binding.
- Therefore it should only be used as a child of the tab or the tabs
- element (in both cases, when they are anonymous nodes of <tabbrowser>).
- -->
- <binding id="tabbrowser-close-tab-button">
- <handlers>
- <handler event="click" button="0"><![CDATA[
- var bindingParent = document.getBindingParent(this);
- var tabContainer = bindingParent.parentNode;
- 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();
- </handler>
-
- <handler event="dragstart">
- event.stopPropagation();
- </handler>
- </handlers>
- </binding>
-
<binding id="tabbrowser-tab" display="xul:hbox"
extends="chrome://global/content/bindings/tabbox.xml#tab">
<resources>
<stylesheet src="chrome://browser/content/tabbrowser.css"/>
</resources>
<content context="tabContextMenu">
<xul:stack class="tab-stack" flex="1">
@@ -8143,61 +8113,81 @@
ContextualIdentityService.setTabStyle(this);
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="mouseover"><![CDATA[
- let anonid = event.originalTarget.getAttribute("anonid");
- if (anonid == "close-button")
+ if (event.originalTarget.getAttribute("anonid") == "close-button") {
this.mOverCloseButton = true;
+ }
this._mouseenter();
]]></handler>
<handler event="mouseout"><![CDATA[
- let anonid = event.originalTarget.getAttribute("anonid");
- if (anonid == "close-button")
+ if (event.originalTarget.getAttribute("anonid") == "close-button") {
this.mOverCloseButton = false;
+ }
this._mouseleave();
]]></handler>
+
<handler event="dragstart" phase="capturing">
this.style.MozUserFocus = "";
</handler>
+
+ <handler event="dragstart"><![CDATA[
+ if (this.mOverCloseButton) {
+ event.stopPropagation();
+ }
+ ]]></handler>
+
<handler event="mousedown" phase="capturing">
<![CDATA[
if (this.selected) {
this.style.MozUserFocus = "ignore";
} else if (this.mOverCloseButton ||
this._overPlayingIcon) {
// Prevent tabbox.xml from selecting the tab.
event.stopPropagation();
}
]]>
</handler>
<handler event="mouseup">
this.style.MozUserFocus = "";
</handler>
- <handler event="click">
- <![CDATA[
- if (event.button != 0) {
- return;
- }
-
+
+ <handler event="click" button="0"><![CDATA[
if (this._overPlayingIcon) {
this.toggleMuteAudio();
+ return;
}
- ]]>
- </handler>
+
+ if (event.originalTarget.getAttribute("anonid") == "close-button") {
+ let tabContainer = this.parentNode;
+ tabContainer.tabbrowser.removeTab(this, {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"><![CDATA[
+ // for the one-close-button case
+ if (event.originalTarget.getAttribute("anonid") == "close-button") {
+ event.stopPropagation();
+ }
+ ]]></handler>
+
<handler event="animationend">
<![CDATA[
- let anonid = event.originalTarget.getAttribute("anonid");
- if (anonid == "tab-loading-burst") {
+ if (event.originalTarget.getAttribute("anonid") == "tab-loading-burst") {
this.removeAttribute("bursting");
}
]]>
</handler>
</handlers>
</binding>
<binding id="tabbrowser-alltabs-popup"