Bug 1429929 - Remove tabbrowser-close-tab-button binding. r=Gijs

MozReview-Commit-ID: 3bIccSfVMuJ

--HG--
extra : rebase_source : ac26550607713effeb9b72a39986d4f2d3b95bf2
This commit is contained in:
Dão Gottwald 2018-01-14 13:12:05 +01:00
Родитель 0ec8be6cd9
Коммит cc32283cef
2 изменённых файлов: 34 добавлений и 48 удалений

Просмотреть файл

@ -10,10 +10,6 @@
-moz-binding: url("chrome://browser/content/tabbrowser.xml#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], .tab-close-button[pinned],
#tabbrowser-tabs[closebuttons="activetab"] > .tabbrowser-tab > .tab-stack > .tab-content > .tab-close-button:not([selected="true"]), #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])[selected],

Просмотреть файл

@ -7210,7 +7210,6 @@
event.originalTarget.localName != "box") event.originalTarget.localName != "box")
return; return;
// See hack note in the tabbrowser-close-tab-button binding
if (!this._blockDblClick) if (!this._blockDblClick)
BrowserOpenTab(); BrowserOpenTab();
@ -7259,8 +7258,7 @@
* double-clicks the button, the dblclick event will be dispatched * double-clicks the button, the dblclick event will be dispatched
* with the tabbar as its event target (and explicit/originalTarget), * with the tabbar as its event target (and explicit/originalTarget),
* which treats that as a mouse gesture for opening a new tab. * which treats that as a mouse gesture for opening a new tab.
* In this context, we're manually blocking the dblclick event * In this context, we're manually blocking the dblclick event.
* (see tabbrowser-close-tab-button dblclick handler).
*/ */
if (this._blockDblClick) { if (this._blockDblClick) {
if (!("_clickedTabBarOnce" in this)) { if (!("_clickedTabBarOnce" in this)) {
@ -7741,34 +7739,6 @@
</handlers> </handlers>
</binding> </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" <binding id="tabbrowser-tab" display="xul:hbox"
extends="chrome://global/content/bindings/tabbox.xml#tab"> extends="chrome://global/content/bindings/tabbox.xml#tab">
<resources> <resources>
@ -8148,22 +8118,30 @@
<handlers> <handlers>
<handler event="mouseover"><![CDATA[ <handler event="mouseover"><![CDATA[
let anonid = event.originalTarget.getAttribute("anonid"); if (event.originalTarget.getAttribute("anonid") == "close-button") {
if (anonid == "close-button")
this.mOverCloseButton = true; this.mOverCloseButton = true;
}
this._mouseenter(); this._mouseenter();
]]></handler> ]]></handler>
<handler event="mouseout"><![CDATA[ <handler event="mouseout"><![CDATA[
let anonid = event.originalTarget.getAttribute("anonid"); if (event.originalTarget.getAttribute("anonid") == "close-button") {
if (anonid == "close-button")
this.mOverCloseButton = false; this.mOverCloseButton = false;
}
this._mouseleave(); this._mouseleave();
]]></handler> ]]></handler>
<handler event="dragstart" phase="capturing"> <handler event="dragstart" phase="capturing">
this.style.MozUserFocus = ""; this.style.MozUserFocus = "";
</handler> </handler>
<handler event="dragstart"><![CDATA[
if (this.mOverCloseButton) {
event.stopPropagation();
}
]]></handler>
<handler event="mousedown" phase="capturing"> <handler event="mousedown" phase="capturing">
<![CDATA[ <![CDATA[
if (this.selected) { if (this.selected) {
@ -8178,21 +8156,33 @@
<handler event="mouseup"> <handler event="mouseup">
this.style.MozUserFocus = ""; this.style.MozUserFocus = "";
</handler> </handler>
<handler event="click">
<![CDATA[ <handler event="click" button="0"><![CDATA[
if (event.button != 0) { if (this._overPlayingIcon) {
this.toggleMuteAudio();
return; return;
} }
if (this._overPlayingIcon) { if (event.originalTarget.getAttribute("anonid") == "close-button") {
this.toggleMuteAudio(); 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>
<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"> <handler event="animationend">
<![CDATA[ <![CDATA[
let anonid = event.originalTarget.getAttribute("anonid"); if (event.originalTarget.getAttribute("anonid") == "tab-loading-burst") {
if (anonid == "tab-loading-burst") {
this.removeAttribute("bursting"); this.removeAttribute("bursting");
} }
]]> ]]>