From d745193724a0340f8437a5a9774500fda3e41a30 Mon Sep 17 00:00:00 2001 From: MaxKoll <39014485+MaxKoll@users.noreply.github.com> Date: Thu, 4 Oct 2018 22:36:30 +0200 Subject: Fix in-tab close button behavior (#775) - Fixes #775. - Coincidentally also fixes a regression that prevented opening new tabs via double click on an empty space in the tab bar. --- application/palemoon/base/content/tabbrowser.xml | 142 +++++++++++++---------- 1 file changed, 81 insertions(+), 61 deletions(-) diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 93818e290..d9cff276a 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -4296,17 +4296,94 @@ event.originalTarget.localName != "box") return; - // See hack note in the tabbrowser-close-tab-button binding + // See comments in the "mousedown" and "click" event handlers of the + // "tabbrowser-tabs" binding. if (!this._blockDblClick) BrowserOpenTab(); + else + this.flagBlockedOpenTabAfterDblClick = true; event.preventDefault(); ]]> - + + + + + 1 || !this._closeWindowWithLastTab) this.tabbrowser.removeTab(event.target, {animate: true, byMouse: true}); @@ -4679,63 +4756,6 @@ - 1 && !this._ignoredClick) { - this._ignoredClick = true; - return; - } - - // Reset the "ignored click" flag - this._ignoredClick = false; - - tabContainer.tabbrowser.removeTab(bindingParent, {animate: true, byMouse: true}); - tabContainer._blockDblClick = true; - - /* XXXmano hack (see bug 343628): - * Since we're removing the event target, if the user - * double-clicks this 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 dblclick handler). - */ - var clickedOnce = false; - function enableDblClick(event) { - var target = event.originalTarget; - if (target.className == 'tab-close-button') - target._ignoredClick = true; - if (!clickedOnce) { - clickedOnce = true; - return; - } - tabContainer._blockDblClick = false; - tabContainer.removeEventListener("click", enableDblClick, true); - } - tabContainer.addEventListener("click", enableDblClick, true); - ]]> - - - // for the one-close-button case - event.stopPropagation(); - - event.stopPropagation(); -- cgit v1.2.3