зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1219215 - final part: ignore middle clicks to open tabs in the middle of closing tabs unless past the end of the last visible tab, r=mconley
--HG-- extra : commitid : 8d1Kcil0vEF extra : rebase_source : c25fb96efa590e0c36985b82d6a69d0d76f15744
This commit is contained in:
Родитель
f5387cf287
Коммит
6bc8a32265
|
@ -5503,7 +5503,25 @@
|
|||
if (event.target.localName == "tab") {
|
||||
this.tabbrowser.removeTab(event.target, {animate: true, byMouse: true});
|
||||
} else if (event.originalTarget.localName == "box") {
|
||||
BrowserOpenTab();
|
||||
// The user middleclicked an open space on the tabstrip. This could
|
||||
// be because they intend to open a new tab, but it could also be
|
||||
// because they just removed a tab and they now middleclicked on the
|
||||
// resulting space while that tab is closing. In that case, we don't
|
||||
// want to open a tab. So if we're removing one or more tabs, and
|
||||
// the tab click is before the end of the last visible tab, we do
|
||||
// nothing.
|
||||
if (this.tabbrowser._removingTabs.length) {
|
||||
let visibleTabs = this.tabbrowser.visibleTabs;
|
||||
let ltr = (window.getComputedStyle(this, null).direction == "ltr");
|
||||
let lastTab = visibleTabs[visibleTabs.length - 1];
|
||||
let endOfTab = lastTab.getBoundingClientRect()[ltr ? "right" : "left"];
|
||||
if ((ltr && event.clientX > endOfTab) ||
|
||||
(!ltr && event.clientX < endOfTab)) {
|
||||
BrowserOpenTab();
|
||||
}
|
||||
} else {
|
||||
BrowserOpenTab();
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче