forked from ZenBrowserMirrors/zen-desktop
Added zen-has-static-label to session store, temporarily removed label persist functionality, rewrote tab reset to use DOM
This commit is contained in:
parent
8080e2fe47
commit
27dc41dd9e
3 changed files with 44 additions and 102 deletions
|
@ -1,5 +1,5 @@
|
|||
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
||||
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafeda43b085 100644
|
||||
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..4faba37097f376b57c7376e320f46e9cd3aacffe 100644
|
||||
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
||||
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
||||
@@ -406,11 +406,52 @@
|
||||
|
@ -25,7 +25,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
+ if (!tab.pinned) {
|
||||
+ break;
|
||||
+ }
|
||||
+ if (!tab.hidden && !tab.hasAttribute("zen-glance-tab")) {
|
||||
+ if (!tab.hidden) {
|
||||
+ i++;
|
||||
+ }
|
||||
+ }
|
||||
|
@ -177,7 +177,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
// Additionally send pinned tab events
|
||||
if (pinned) {
|
||||
this._notifyPinnedStatus(t);
|
||||
@@ -3403,6 +3468,21 @@
|
||||
@@ -3403,6 +3455,24 @@
|
||||
) {
|
||||
tabWasReused = true;
|
||||
tab = this.selectedTab;
|
||||
|
@ -195,11 +195,14 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
+ }
|
||||
+ if (tabData.zenPinnedEntry) {
|
||||
+ tab.setAttribute("zen-pinned-entry", tabData.zenPinnedEntry);
|
||||
+ }
|
||||
+ if (tabData.zenHasStaticLabel) {
|
||||
+ tab.setAttribute("zen-has-static-label", "true");
|
||||
+ }
|
||||
if (!tabData.pinned) {
|
||||
this.unpinTab(tab);
|
||||
} else {
|
||||
@@ -3416,6 +3496,7 @@
|
||||
@@ -3416,6 +3486,7 @@
|
||||
restoreTabsLazily && !select && !tabData.pinned;
|
||||
|
||||
let url = "about:blank";
|
||||
|
@ -207,7 +210,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
if (tabData.entries?.length) {
|
||||
let activeIndex = (tabData.index || tabData.entries.length) - 1;
|
||||
// Ensure the index is in bounds.
|
||||
@@ -3451,7 +3532,21 @@
|
||||
@@ -3451,7 +3522,24 @@
|
||||
skipLoad: true,
|
||||
preferredRemoteType,
|
||||
});
|
||||
|
@ -226,22 +229,14 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
+ }
|
||||
+ if (tabData.zenPinnedEntry) {
|
||||
+ tab.setAttribute("zen-pinned-entry", tabData.zenPinnedEntry);
|
||||
+ }
|
||||
+ if (tabData.zenHasStaticLabel) {
|
||||
+ tab.setAttribute("zen-has-static-label", "true");
|
||||
+ }
|
||||
if (select) {
|
||||
tabToSelect = tab;
|
||||
}
|
||||
@@ -3464,8 +3559,8 @@
|
||||
// inserted in the DOM. If the tab is not yet in the DOM,
|
||||
// just insert it in the right place from the start.
|
||||
if (!tab.parentNode) {
|
||||
- tab._tPos = this.pinnedTabCount;
|
||||
- this.tabContainer.insertBefore(tab, this.tabs[this.pinnedTabCount]);
|
||||
+ tab._tPos = this._numVisiblePinTabs;
|
||||
+ this.tabContainer.insertBefore(tab, this.tabs[this._numVisiblePinTabs]);
|
||||
tab.toggleAttribute("pinned", true);
|
||||
this.tabContainer._invalidateCachedTabs();
|
||||
// Then ensure all the tab open/pinning information is sent.
|
||||
@@ -3729,7 +3824,7 @@
|
||||
@@ -3729,7 +3817,7 @@
|
||||
// Ensure we have an index if one was not provided.
|
||||
if (typeof index != "number") {
|
||||
// Move the new tab after another tab if needed, to the end otherwise.
|
||||
|
@ -250,7 +245,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
if (
|
||||
!bulkOrderedOpen &&
|
||||
((openerTab &&
|
||||
@@ -3780,7 +3875,7 @@
|
||||
@@ -3780,7 +3868,7 @@
|
||||
}
|
||||
|
||||
/** @type {MozTabbrowserTab|undefined} */
|
||||
|
@ -259,7 +254,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
this.tabContainer._invalidateCachedTabs();
|
||||
|
||||
if (tabGroup) {
|
||||
@@ -4095,6 +4190,9 @@
|
||||
@@ -4095,6 +4183,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -269,7 +264,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
this.removeTabs(selectedTabs);
|
||||
}
|
||||
|
||||
@@ -4427,6 +4525,7 @@
|
||||
@@ -4427,6 +4518,7 @@
|
||||
skipSessionStore,
|
||||
} = {}
|
||||
) {
|
||||
|
@ -277,7 +272,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
if (UserInteraction.running("browser.tabs.opening", window)) {
|
||||
UserInteraction.finish("browser.tabs.opening", window);
|
||||
}
|
||||
@@ -4443,6 +4542,12 @@
|
||||
@@ -4443,6 +4535,12 @@
|
||||
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
||||
}
|
||||
|
||||
|
@ -290,7 +285,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
// Handle requests for synchronously removing an already
|
||||
// asynchronously closing tab.
|
||||
if (!animate && aTab.closing) {
|
||||
@@ -4457,7 +4562,9 @@
|
||||
@@ -4457,7 +4555,9 @@
|
||||
// frame created for it (for example, by updating the visually selected
|
||||
// state).
|
||||
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
|
||||
|
@ -301,7 +296,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
if (
|
||||
!this._beginRemoveTab(aTab, {
|
||||
closeWindowFastpath: true,
|
||||
@@ -4471,7 +4578,6 @@
|
||||
@@ -4471,7 +4571,6 @@
|
||||
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
||||
return;
|
||||
}
|
||||
|
@ -309,7 +304,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
let lockTabSizing =
|
||||
!this.tabContainer.verticalMode &&
|
||||
!aTab.pinned &&
|
||||
@@ -4610,14 +4716,14 @@
|
||||
@@ -4610,14 +4709,14 @@
|
||||
!!this.tabsInCollapsedTabGroups.length;
|
||||
if (
|
||||
aTab.visible &&
|
||||
|
@ -326,16 +321,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
|
||||
if (closeWindow) {
|
||||
// We've already called beforeunload on all the relevant tabs if we get here,
|
||||
@@ -4812,6 +4918,8 @@
|
||||
this.tabs[i]._tPos = i;
|
||||
}
|
||||
|
||||
+ ZenWorkspaces.updateTabsContainers();
|
||||
+
|
||||
if (!this._windowIsClosing) {
|
||||
if (wasPinned) {
|
||||
this.tabContainer._positionPinnedTabs();
|
||||
@@ -5465,10 +5573,10 @@
|
||||
@@ -5465,10 +5564,10 @@
|
||||
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
||||
}
|
||||
|
||||
|
@ -348,28 +334,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
aTab.selected ||
|
||||
aTab.closing ||
|
||||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
|
||||
@@ -5706,9 +5814,9 @@
|
||||
|
||||
// Don't allow mixing pinned and unpinned tabs.
|
||||
if (aTab.pinned) {
|
||||
- aIndex = Math.min(aIndex, this.pinnedTabCount - 1);
|
||||
+ aIndex = Math.min(aIndex, (aTab.hasAttribute('zen-essential') ? this._numZenEssentials : this._numVisiblePinTabsWithoutGlance) - 1);
|
||||
} else {
|
||||
- aIndex = Math.max(aIndex, this.pinnedTabCount);
|
||||
+ aIndex = Math.max(aIndex, this._numVisiblePinTabsWithoutGlance);
|
||||
}
|
||||
if (aTab._tPos == aIndex) {
|
||||
return;
|
||||
@@ -5717,7 +5825,7 @@
|
||||
this._lastRelatedTabMap = new WeakMap();
|
||||
|
||||
this._handleTabMove(aTab, () => {
|
||||
- let neighbor = this.tabs[aIndex];
|
||||
+ let neighbor = this.tabs.filter(tab => !tab.hasAttribute("zen-glance-tab"))[aIndex];
|
||||
if (forceStandaloneTab && neighbor.group) {
|
||||
neighbor = neighbor.group;
|
||||
}
|
||||
@@ -5727,6 +5835,9 @@
|
||||
@@ -5727,6 +5826,9 @@
|
||||
this.tabContainer.insertBefore(aTab, neighbor);
|
||||
}
|
||||
});
|
||||
|
@ -379,16 +344,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
}
|
||||
|
||||
moveTabToGroup(aTab, aGroup) {
|
||||
@@ -5802,7 +5913,7 @@
|
||||
createLazyBrowser,
|
||||
};
|
||||
|
||||
- let numPinned = this.pinnedTabCount;
|
||||
+ let numPinned = this._numVisiblePinTabs;
|
||||
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
|
||||
params.pinned = true;
|
||||
}
|
||||
@@ -7443,6 +7554,7 @@
|
||||
@@ -7443,6 +7545,7 @@
|
||||
aWebProgress.isTopLevel
|
||||
) {
|
||||
this.mTab.setAttribute("busy", "true");
|
||||
|
@ -396,7 +352,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||
gBrowser.syncThrobberAnimations(this.mTab);
|
||||
@@ -8411,7 +8523,7 @@ var TabContextMenu = {
|
||||
@@ -8411,7 +8514,7 @@ var TabContextMenu = {
|
||||
);
|
||||
contextUnpinSelectedTabs.hidden =
|
||||
!this.contextTab.pinned || !multiselectionContext;
|
||||
|
@ -405,7 +361,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
// Move Tab items
|
||||
let contextMoveTabOptions = document.getElementById(
|
||||
"context_moveTabOptions"
|
||||
@@ -8444,7 +8556,7 @@ var TabContextMenu = {
|
||||
@@ -8444,7 +8547,7 @@ var TabContextMenu = {
|
||||
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
||||
let isFirstTab =
|
||||
tabsToMove[0] == visibleTabs[0] ||
|
||||
|
@ -414,7 +370,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
|||
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
||||
|
||||
document.getElementById("context_openTabInWindow").disabled =
|
||||
@@ -8677,6 +8789,7 @@ var TabContextMenu = {
|
||||
@@ -8677,6 +8780,7 @@ var TabContextMenu = {
|
||||
if (this.contextTab.multiselected) {
|
||||
gBrowser.removeMultiSelectedTabs();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue