зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1435142 - Part 1: pref to enable close selected tab by dblclicking it. r=dao
MozReview-Commit-ID: ErulnUeVK0F --HG-- extra : rebase_source : f9aaaa4ee6bf005e40b6f9f88255c589d2695e74
This commit is contained in:
Родитель
15414c4ffe
Коммит
dd3e7ab8f5
|
@ -463,6 +463,7 @@ pref("browser.link.open_newwindow.disabled_in_fullscreen", false);
|
|||
#endif
|
||||
|
||||
// Tabbed browser
|
||||
pref("browser.tabs.closeTabByDblclick", false);
|
||||
pref("browser.tabs.closeWindowWithLastTab", true);
|
||||
pref("browser.tabs.insertRelatedAfterCurrent", true);
|
||||
pref("browser.tabs.warnOnClose", true);
|
||||
|
|
|
@ -143,6 +143,9 @@
|
|||
|
||||
CustomizableUI.addListener(this);
|
||||
this._updateNewTabVisibility();
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "_closeTabByDblclick",
|
||||
"browser.tabs.closeTabByDblclick", false);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
|
@ -1689,6 +1692,7 @@
|
|||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
<field name="_selectedOnFirstMouseDown">false</field>
|
||||
|
||||
<property name="pinned" readonly="true">
|
||||
<getter>
|
||||
|
@ -1992,6 +1996,13 @@
|
|||
|
||||
<handler event="mousedown" phase="capturing">
|
||||
<![CDATA[
|
||||
let tabContainer = this.parentNode;
|
||||
if (tabContainer._closeTabByDblclick &&
|
||||
event.button == 0 &&
|
||||
event.detail == 1) {
|
||||
this._selectedOnFirstMouseDown = this.selected;
|
||||
}
|
||||
|
||||
if (this.selected) {
|
||||
this.style.MozUserFocus = "ignore";
|
||||
} else if (this.mOverCloseButton ||
|
||||
|
@ -2027,6 +2038,17 @@
|
|||
if (event.originalTarget.getAttribute("anonid") == "close-button") {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
let tabContainer = this.parentNode;
|
||||
if (tabContainer._closeTabByDblclick &&
|
||||
this._selectedOnFirstMouseDown &&
|
||||
this.selected &&
|
||||
!this._overPlayingIcon) {
|
||||
gBrowser.removeTab(this, {
|
||||
animate: true,
|
||||
byMouse: event.mozInputSource == MouseEvent.MOZ_SOURCE_MOUSE,
|
||||
});
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
<handler event="animationend">
|
||||
|
|
Загрузка…
Ссылка в новой задаче