From 31d61afe8cce9ab309ba65316239e378d7f88d34 Mon Sep 17 00:00:00 2001 From: "Abdoulaye O. Ly" Date: Wed, 24 Oct 2018 17:26:24 +0000 Subject: [PATCH] Bug 1499227 - Trigger multiselect on mousedown event instead of on click event. r=jaws Differential Revision: https://phabricator.services.mozilla.com/D9359 --HG-- extra : moz-landing-system : lando --- browser/base/content/tabbrowser.xml | 91 +++++++++---------- .../tabs/browser_multiselect_tabs_close.js | 3 +- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 7619f85c4023..1e59afea49ea 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -2314,11 +2314,8 @@ @@ -2353,43 +2374,21 @@ 0 && + !this.mOverCloseButton && + !this._overPlayingIcon) { + // Tabs were previously multi-selected and user clicks on a tab + // without holding Ctrl/Cmd Key - const overCloseButton = event.originalTarget.getAttribute("anonid") == "close-button"; - if (gBrowser.multiSelectedTabsCount > 0 && !overCloseButton && !this._overPlayingIcon) { - // Tabs were previously multi-selected and user clicks on a tab - // without holding Ctrl/Cmd Key + // Force positional attributes to update when the + // target (of the click) is the "active" tab. + let updatePositionalAttr = gBrowser.selectedTab == this; - // Force positional attributes to update when the - // target (of the click) is the "active" tab. - let updatePositionalAttr = gBrowser.selectedTab == this; - - gBrowser.clearMultiSelectedTabs(updatePositionalAttr); - } + gBrowser.clearMultiSelectedTabs(updatePositionalAttr); } if (this._overPlayingIcon) { diff --git a/browser/base/content/test/tabs/browser_multiselect_tabs_close.js b/browser/base/content/test/tabs/browser_multiselect_tabs_close.js index 6d2068ef39a2..a67d514bdb31 100644 --- a/browser/base/content/test/tabs/browser_multiselect_tabs_close.js +++ b/browser/base/content/test/tabs/browser_multiselect_tabs_close.js @@ -48,7 +48,8 @@ add_task(async function usingTabCloseButton() { is(gBrowser.multiSelectedTabsCount, 2, "Two multiselected tabs"); // Closing a selected tab - let tab2CloseBtn = document.getAnonymousElementByAttribute(tab1, "anonid", "close-button"); + let tab2CloseBtn = document.getAnonymousElementByAttribute(tab2, "anonid", "close-button"); + tab2.mOverCloseButton = true; let tab1Closing = BrowserTestUtils.waitForTabClosing(tab1); let tab2Closing = BrowserTestUtils.waitForTabClosing(tab2); tab2CloseBtn.click();