Fixed normal tabs appear on pinned tab container

This commit is contained in:
mr. m 2025-02-11 13:26:50 +01:00
parent f2460549e0
commit 7cf0e05f70
No known key found for this signature in database
GPG key ID: 419302196C23B258
3 changed files with 62 additions and 7 deletions

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..39cb6ceda6154609daa8f3b84c4931de6604534f 100644
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..f7c02c14498b4ec5fcf5521480c88abac25a2283 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -406,11 +406,39 @@
@ -44,7 +44,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..39cb6ceda6154609daa8f3b84c4931de
}
return i;
}
@@ -807,7 +835,7 @@
@@ -807,10 +835,10 @@
this.showTab(aTab);
if (this.tabContainer.verticalMode) {
this._handleTabMove(aTab, () =>
@ -52,7 +52,20 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..39cb6ceda6154609daa8f3b84c4931de
+ aTab.hasAttribute("zen-essential") ? document.getElementById("zen-essentials-container").appendChild(aTab) : this.verticalPinnedTabsContainer.appendChild(aTab)
);
} else {
this.moveTabTo(aTab, this.pinnedTabCount, { forceStandaloneTab: true });
- this.moveTabTo(aTab, this.pinnedTabCount, { forceStandaloneTab: true });
+ this.moveTabTo(aTab, this._numVisiblePinTabs, { forceStandaloneTab: true });
}
aTab.setAttribute("pinned", "true");
this._updateTabBarForPinnedTabs();
@@ -831,7 +859,7 @@
this.tabContainer.arrowScrollbox.prepend(aTab);
});
} else {
- this.moveTabTo(aTab, this.pinnedTabCount - 1, {
+ this.moveTabTo(aTab, this._numVisiblePinTabs - 1, {
forceStandaloneTab: true,
});
aTab.removeAttribute("pinned");
@@ -1055,6 +1083,8 @@
let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"];
@ -197,16 +210,36 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..39cb6ceda6154609daa8f3b84c4931de
if (select) {
tabToSelect = tab;
}
@@ -3464,8 +3546,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 +3811,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.
- index = Infinity;
+ index = Services.prefs.getBoolPref("zen.view.show-newtab-button-top") ? this.pinnedTabCount : Infinity;
+ index = Services.prefs.getBoolPref("zen.view.show-newtab-button-top") ? this._numVisiblePinTabs : Infinity;
if (
!bulkOrderedOpen &&
((openerTab &&
@@ -3780,7 +3862,7 @@
@@ -3773,14 +3855,14 @@
// Ensure index is within bounds.
if (tab.pinned) {
index = Math.max(index, 0);
- index = Math.min(index, this.pinnedTabCount);
+ index = Math.min(index, this._numVisiblePinTabs);
} else {
- index = Math.max(index, this.pinnedTabCount);
+ index = Math.max(index, this._numVisiblePinTabs);
index = Math.min(index, this.tabs.length);
}
/** @type {MozTabbrowserTab|undefined} */
@ -295,6 +328,18 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..39cb6ceda6154609daa8f3b84c4931de
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -5706,9 +5799,9 @@
// Don't allow mixing pinned and unpinned tabs.
if (aTab.pinned) {
- aIndex = Math.min(aIndex, this.pinnedTabCount - 1);
+ aIndex = Math.min(aIndex, this._numVisiblePinTabs - 1);
} else {
- aIndex = Math.max(aIndex, this.pinnedTabCount);
+ aIndex = Math.max(aIndex, this._numVisiblePinTabs);
}
if (aTab._tPos == aIndex) {
return;
@@ -5727,6 +5820,9 @@
this.tabContainer.insertBefore(aTab, neighbor);
}
@ -305,6 +350,15 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..39cb6ceda6154609daa8f3b84c4931de
}
moveTabToGroup(aTab, aGroup) {
@@ -5802,7 +5898,7 @@
createLazyBrowser,
};
- let numPinned = this.pinnedTabCount;
+ let numPinned = this._numVisiblePinTabs;
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
params.pinned = true;
}
@@ -7443,6 +7539,7 @@
aWebProgress.isTopLevel
) {