зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1614555 - Update the tab manager menu when tabs are modified through their context menu r=dao
Differential Revision: https://phabricator.services.mozilla.com/D62602 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
27ffbb2854
Коммит
f85942fc24
|
@ -47,6 +47,14 @@ class TabsListBase {
|
|||
case "TabClose":
|
||||
this._tabClose(event.target);
|
||||
break;
|
||||
case "TabMove":
|
||||
this._moveTab(event.target);
|
||||
break;
|
||||
case "TabPinned":
|
||||
if (!this.filterFn(event.target)) {
|
||||
this._tabClose(event.target);
|
||||
}
|
||||
break;
|
||||
case "command":
|
||||
this._selectTab(event.target.tab);
|
||||
break;
|
||||
|
@ -96,11 +104,15 @@ class TabsListBase {
|
|||
this.listenersRegistered = true;
|
||||
this.gBrowser.tabContainer.addEventListener("TabAttrModified", this);
|
||||
this.gBrowser.tabContainer.addEventListener("TabClose", this);
|
||||
this.gBrowser.tabContainer.addEventListener("TabMove", this);
|
||||
this.gBrowser.tabContainer.addEventListener("TabPinned", this);
|
||||
}
|
||||
|
||||
_cleanupListeners() {
|
||||
this.gBrowser.tabContainer.removeEventListener("TabAttrModified", this);
|
||||
this.gBrowser.tabContainer.removeEventListener("TabClose", this);
|
||||
this.gBrowser.tabContainer.removeEventListener("TabMove", this);
|
||||
this.gBrowser.tabContainer.removeEventListener("TabPinned", this);
|
||||
this.listenersRegistered = false;
|
||||
}
|
||||
|
||||
|
@ -119,7 +131,17 @@ class TabsListBase {
|
|||
}
|
||||
}
|
||||
|
||||
_moveTab(tab) {
|
||||
let item = this.tabToElement.get(tab);
|
||||
if (item) {
|
||||
this._removeItem(item, tab);
|
||||
this._addTab(tab);
|
||||
}
|
||||
}
|
||||
_addTab(newTab) {
|
||||
if (!this.filterFn(newTab)) {
|
||||
return;
|
||||
}
|
||||
let newRow = this._createRow(newTab);
|
||||
let nextTab = newTab.nextElementSibling;
|
||||
|
||||
|
@ -127,16 +149,15 @@ class TabsListBase {
|
|||
nextTab = nextTab.nextElementSibling;
|
||||
}
|
||||
|
||||
if (nextTab) {
|
||||
// If we found a tab after this one in the list, insert the new row before it.
|
||||
let nextRow = this.tabToElement.get(nextTab);
|
||||
// If we found a tab after this one in the list, insert the new row before it.
|
||||
let nextRow = this.tabToElement.get(nextTab);
|
||||
if (nextRow) {
|
||||
nextRow.parentNode.insertBefore(newRow, nextRow);
|
||||
} else {
|
||||
// If there's no next tab then insert it as usual.
|
||||
this._addElement(newRow);
|
||||
}
|
||||
}
|
||||
|
||||
_tabClose(tab) {
|
||||
let item = this.tabToElement.get(tab);
|
||||
if (item) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче