diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index 77ee31337..17d3d4e4d 100644 --- a/src/browser/components/tabbrowser/content/tabbrowser-js.patch +++ b/src/browser/components/tabbrowser/content/tabbrowser-js.patch @@ -1,8 +1,8 @@ diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js -index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9f61ca14c 100644 +index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b930f411c 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js -@@ -415,11 +415,67 @@ +@@ -415,11 +415,71 @@ return this.tabContainer.visibleTabs; } @@ -19,6 +19,10 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 + return i; + } + ++ zenInsertTabAtIndex(...args) { ++ return this.#insertTabAtElementIndex(...args); ++ } ++ + get _numVisiblePinTabsWithoutCollapsed() { + let i = 0; + for (let item of this.tabContainer.ariaFocusableItems) { @@ -72,7 +76,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } return i; } -@@ -549,6 +605,7 @@ +@@ -549,6 +609,7 @@ this.tabpanels.appendChild(panel); let tab = this.tabs[0]; @@ -80,7 +84,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 tab.linkedPanel = uniqueId; this._selectedTab = tab; this._selectedBrowser = browser; -@@ -814,11 +871,13 @@ +@@ -814,11 +875,13 @@ } this.showTab(aTab); @@ -97,7 +101,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 this.moveTabTo(aTab, { tabIndex: this.pinnedTabCount, forceUngrouped: true, -@@ -835,12 +894,15 @@ +@@ -835,12 +898,15 @@ } if (this.tabContainer.verticalMode) { @@ -114,7 +118,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 }); } else { this.moveTabTo(aTab, { -@@ -1024,6 +1086,8 @@ +@@ -1024,6 +1090,8 @@ let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"]; @@ -123,7 +127,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if ( aIconURL && !aLoadingPrincipal && -@@ -1034,6 +1098,9 @@ +@@ -1034,6 +1102,9 @@ ); return; } @@ -133,7 +137,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 let browser = this.getBrowserForTab(aTab); browser.mIconURL = aIconURL; -@@ -1283,6 +1350,7 @@ +@@ -1283,6 +1354,7 @@ if (!this._previewMode) { newTab.recordTimeFromUnloadToReload(); newTab.updateLastAccessed(); @@ -141,7 +145,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 oldTab.updateLastAccessed(); // if this is the foreground window, update the last-seen timestamps. if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) { -@@ -1435,6 +1503,9 @@ +@@ -1435,6 +1507,9 @@ } let activeEl = document.activeElement; @@ -151,7 +155,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 // If focus is on the old tab, move it to the new tab. if (activeEl == oldTab) { newTab.focus(); -@@ -1758,7 +1829,8 @@ +@@ -1758,7 +1833,8 @@ } _setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle, isURL } = {}) { @@ -161,7 +165,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 return false; } -@@ -1866,7 +1938,7 @@ +@@ -1866,7 +1942,7 @@ newIndex = this.selectedTab._tPos + 1; } @@ -170,7 +174,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (this.isTabGroupLabel(targetTab)) { throw new Error( "Replacing a tab group label with a tab is not supported" -@@ -2130,6 +2202,7 @@ +@@ -2130,6 +2206,7 @@ uriIsAboutBlank, userContextId, skipLoad, @@ -178,7 +182,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } = {}) { let b = document.createXULElement("browser"); // Use the JSM global to create the permanentKey, so that if the -@@ -2203,8 +2276,7 @@ +@@ -2203,8 +2280,7 @@ // we use a different attribute name for this? b.setAttribute("name", name); } @@ -188,7 +192,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 b.setAttribute("transparent", "true"); } -@@ -2369,7 +2441,7 @@ +@@ -2369,7 +2445,7 @@ let panel = this.getPanel(browser); let uniqueId = this._generateUniquePanelID(); @@ -197,7 +201,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 aTab.linkedPanel = uniqueId; // Inject the into the DOM if necessary. -@@ -2428,8 +2500,8 @@ +@@ -2428,8 +2504,8 @@ // If we transitioned from one browser to two browsers, we need to set // hasSiblings=false on both the existing browser and the new browser. if (this.tabs.length == 2) { @@ -208,7 +212,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } else { aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1; } -@@ -2657,6 +2729,7 @@ +@@ -2657,6 +2733,7 @@ schemelessInput, hasValidUserGestureActivation = false, textDirectiveUserActivation = false, @@ -216,7 +220,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } = {} ) { // all callers of addTab that pass a params object need to pass -@@ -2667,6 +2740,12 @@ +@@ -2667,6 +2744,12 @@ ); } @@ -229,7 +233,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (!UserInteraction.running("browser.tabs.opening", window)) { UserInteraction.start("browser.tabs.opening", "initting", window); } -@@ -2730,6 +2809,16 @@ +@@ -2730,6 +2813,16 @@ noInitialLabel, skipBackgroundNotify, }); @@ -246,7 +250,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (insertTab) { if (typeof index == "number") { elementIndex = this.#tabIndexToElementIndex(index); -@@ -2756,6 +2845,7 @@ +@@ -2756,6 +2849,7 @@ initialBrowsingContextGroupId, openWindowInfo, skipLoad, @@ -254,7 +258,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 })); if (focusUrlBar) { -@@ -2875,6 +2965,9 @@ +@@ -2875,6 +2969,9 @@ } } @@ -264,7 +268,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 // Additionally send pinned tab events if (pinned) { this._notifyPinnedStatus(t); -@@ -2922,12 +3015,15 @@ +@@ -2922,12 +3019,15 @@ * @param {string} [label=] * @returns {MozTabbrowserTabGroup} */ @@ -281,7 +285,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 return group; } -@@ -2970,6 +3066,7 @@ +@@ -2970,6 +3070,7 @@ insertBefore = null, isUserTriggered = false, telemetryUserCreateSource = "unknown", @@ -289,7 +293,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } = {} ) { if (!tabs?.length) { -@@ -2988,7 +3085,12 @@ +@@ -2988,7 +3089,12 @@ id = `${Date.now()}-${Math.round(Math.random() * 100)}`; } let group = this._createTabGroup(id, color, false, label); @@ -303,7 +307,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 group, insertBefore?.group ?? insertBefore ); -@@ -3318,6 +3420,7 @@ +@@ -3318,6 +3424,7 @@ initialBrowsingContextGroupId, openWindowInfo, skipLoad, @@ -311,7 +315,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } ) { // If we don't have a preferred remote type, and we have a remote -@@ -3381,6 +3484,7 @@ +@@ -3381,6 +3488,7 @@ openWindowInfo, name, skipLoad, @@ -319,7 +323,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 }); } -@@ -3559,6 +3663,27 @@ +@@ -3559,6 +3667,27 @@ ) { tabWasReused = true; tab = this.selectedTab; @@ -347,7 +351,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (!tabData.pinned) { this.unpinTab(tab); } else { -@@ -3607,8 +3732,28 @@ +@@ -3607,8 +3736,28 @@ skipLoad: true, preferredRemoteType, }); @@ -378,7 +382,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 tabToSelect = tab; } } -@@ -3620,8 +3765,8 @@ +@@ -3620,8 +3769,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) { @@ -389,7 +393,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 tab.toggleAttribute("pinned", true); this.tabContainer._invalidateCachedTabs(); // Then ensure all the tab open/pinning information is sent. -@@ -3631,7 +3776,8 @@ +@@ -3631,7 +3780,8 @@ // needs calling: shouldUpdateForPinnedTabs = true; } @@ -399,7 +403,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 let { groupId } = tabData; const tabGroup = tabGroupWorkingData.get(groupId); // if a tab refers to a tab group we don't know, skip any group -@@ -3645,7 +3791,10 @@ +@@ -3645,7 +3795,10 @@ tabGroup.stateData.id, tabGroup.stateData.color, tabGroup.stateData.collapsed, @@ -411,7 +415,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 ); tabsFragment.appendChild(tabGroup.node); } -@@ -3696,6 +3845,9 @@ +@@ -3696,6 +3849,9 @@ this.selectedTab = tabToSelect; this.removeTab(leftoverTab); } @@ -421,7 +425,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (tabs.length > 1 || !tabs[0].selected) { this._updateTabsAfterInsert(); -@@ -3882,7 +4034,7 @@ +@@ -3882,7 +4038,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. @@ -430,7 +434,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if ( !bulkOrderedOpen && ((openerTab && -@@ -3928,18 +4080,18 @@ +@@ -3928,18 +4084,18 @@ // Ensure index is within bounds. if (tab.pinned) { @@ -453,7 +457,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (this.isTab(itemAfter) && itemAfter.group == tabGroup) { // Place at the front of, or between tabs in, the same tab group this.tabContainer.insertBefore(tab, itemAfter); -@@ -4260,6 +4412,9 @@ +@@ -4260,6 +4416,9 @@ return; } @@ -463,7 +467,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 this.removeTabs(selectedTabs, { telemetrySource }); } -@@ -4512,6 +4667,7 @@ +@@ -4512,6 +4671,7 @@ telemetrySource, } = {} ) { @@ -471,7 +475,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 // When 'closeWindowWithLastTab' pref is enabled, closing all tabs // can be considered equivalent to closing the window. if ( -@@ -4596,6 +4752,7 @@ +@@ -4596,6 +4756,7 @@ if (lastToClose) { this.removeTab(lastToClose, aParams); } @@ -479,7 +483,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } catch (e) { console.error(e); } -@@ -4620,6 +4777,7 @@ +@@ -4620,6 +4781,7 @@ telemetrySource, } = {} ) { @@ -487,7 +491,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (UserInteraction.running("browser.tabs.opening", window)) { UserInteraction.finish("browser.tabs.opening", window); } -@@ -4633,6 +4791,12 @@ +@@ -4633,6 +4795,12 @@ aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start(); } @@ -500,7 +504,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 // Handle requests for synchronously removing an already // asynchronously closing tab. if (!animate && aTab.closing) { -@@ -4647,7 +4811,9 @@ +@@ -4647,7 +4815,9 @@ // frame created for it (for example, by updating the visually selected // state). let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width; @@ -511,7 +515,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if ( !this._beginRemoveTab(aTab, { closeWindowFastpath: true, -@@ -4810,7 +4976,7 @@ +@@ -4810,7 +4980,7 @@ closeWindowWithLastTab != null ? closeWindowWithLastTab : !window.toolbar.visible || @@ -520,7 +524,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (closeWindow) { // We've already called beforeunload on all the relevant tabs if we get here, -@@ -4834,6 +5000,7 @@ +@@ -4834,6 +5004,7 @@ newTab = true; } @@ -528,7 +532,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 aTab._endRemoveArgs = [closeWindow, newTab]; // swapBrowsersAndCloseOther will take care of closing the window without animation. -@@ -4873,9 +5040,7 @@ +@@ -4873,9 +5044,7 @@ aTab._mouseleave(); if (newTab) { @@ -539,7 +543,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } else { TabBarVisibility.update(); } -@@ -5004,6 +5169,8 @@ +@@ -5004,6 +5173,8 @@ this.tabs[i]._tPos = i; } @@ -548,7 +552,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (!this._windowIsClosing) { if (wasPinned) { this.tabContainer._positionPinnedTabs(); -@@ -5129,8 +5296,8 @@ +@@ -5129,8 +5300,8 @@ return closedCount; } @@ -559,7 +563,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (unloadBlocked) { return; } -@@ -5230,13 +5397,13 @@ +@@ -5230,13 +5401,13 @@ !excludeTabs.has(aTab.owner) && Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose") ) { @@ -575,7 +579,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 ); let tab = this.tabContainer.findNextTab(aTab, { -@@ -5252,7 +5419,7 @@ +@@ -5252,7 +5423,7 @@ } if (tab) { @@ -584,7 +588,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } // If no qualifying visible tab was found, see if there is a tab in -@@ -5273,7 +5440,7 @@ +@@ -5273,7 +5444,7 @@ }); } @@ -593,7 +597,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } _blurTab(aTab) { -@@ -5674,10 +5841,10 @@ +@@ -5674,10 +5845,10 @@ SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); } @@ -606,7 +610,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 aTab.selected || aTab.closing || // Tabs that are sharing the screen, microphone or camera cannot be hidden. -@@ -5971,7 +6138,7 @@ +@@ -5971,7 +6142,7 @@ // Don't allow mixing pinned and unpinned tabs. if (this.isTab(element) && element.pinned) { @@ -615,7 +619,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 } else { tabIndex = Math.max(tabIndex, this.pinnedTabCount); } -@@ -5998,9 +6165,16 @@ +@@ -5998,9 +6169,16 @@ element, () => { let neighbor = this.tabs[tabIndex]; @@ -633,7 +637,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (neighbor && this.isTab(element) && tabIndex > element._tPos) { neighbor.after(element); } else { -@@ -6069,7 +6243,9 @@ +@@ -6069,7 +6247,9 @@ targetElement = targetElement.group; } } @@ -644,7 +648,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 // Don't allow mixing pinned and unpinned tabs. if (element.pinned && !targetElement?.pinned) { targetElement = this.tabs[this.pinnedTabCount - 1]; -@@ -6079,7 +6255,13 @@ +@@ -6079,7 +6259,13 @@ moveBefore = true; } @@ -658,7 +662,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if (element.pinned && this.tabContainer.verticalMode) { return this.tabContainer.verticalPinnedTabsContainer; } -@@ -6139,7 +6321,7 @@ +@@ -6139,7 +6325,7 @@ if (!this.isTab(aTab)) { throw new Error("Can only move a tab into a tab group"); } @@ -667,7 +671,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 return; } if (aTab.group && aTab.group.id === aGroup.id) { -@@ -6233,6 +6415,10 @@ +@@ -6233,6 +6419,10 @@ moveActionCallback(); @@ -678,7 +682,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 // Clear tabs cache after moving nodes because the order of tabs may have // changed. this.tabContainer._invalidateCachedTabs(); -@@ -6290,7 +6476,7 @@ +@@ -6290,7 +6480,7 @@ createLazyBrowser, }; @@ -687,7 +691,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 if ( elementIndex < numPinned || (aTab.pinned && elementIndex == numPinned) -@@ -7050,7 +7236,7 @@ +@@ -7050,7 +7240,7 @@ // preventDefault(). It will still raise the window if appropriate. break; } @@ -696,7 +700,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 window.focus(); aEvent.preventDefault(); break; -@@ -7951,6 +8137,7 @@ +@@ -7951,6 +8141,7 @@ aWebProgress.isTopLevel ) { this.mTab.setAttribute("busy", "true"); @@ -704,7 +708,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 gBrowser._tabAttrModified(this.mTab, ["busy"]); this.mTab._notselectedsinceload = !this.mTab.selected; } -@@ -8924,7 +9111,7 @@ var TabContextMenu = { +@@ -8924,7 +9115,7 @@ var TabContextMenu = { ); contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !this.multiselected; @@ -713,7 +717,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 // Move Tab items let contextMoveTabOptions = document.getElementById( "context_moveTabOptions" -@@ -8958,7 +9145,7 @@ var TabContextMenu = { +@@ -8958,7 +9149,7 @@ var TabContextMenu = { let isFirstTab = !this.contextTabs[0].group && (this.contextTabs[0] == visibleTabs[0] || @@ -722,7 +726,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..1ba8b8c51f27d92222f1e682681cf9c9 contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent; document.getElementById("context_openTabInWindow").disabled = -@@ -9193,6 +9380,7 @@ var TabContextMenu = { +@@ -9193,6 +9384,7 @@ var TabContextMenu = { telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP, }); } else { diff --git a/src/browser/components/tabbrowser/content/tabs-js.patch b/src/browser/components/tabbrowser/content/tabs-js.patch index 94d7c924d..6e2604056 100644 --- a/src/browser/components/tabbrowser/content/tabs-js.patch +++ b/src/browser/components/tabbrowser/content/tabs-js.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js -index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1a977b7b1 100644 +index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..eee9613b4405a8a301cef3db1ae6a3f9d21d56ac 100644 --- a/browser/components/tabbrowser/content/tabs.js +++ b/browser/components/tabbrowser/content/tabs.js @@ -83,7 +83,7 @@ @@ -37,6 +37,15 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 let tabsPerRow = 0; let position = 0; for (let pinnedTab of pinnedTabs) { +@@ -764,7 +765,7 @@ + } else if (isTabGroupLabel(tab) && !tab.group.collapsed) { + this._lockTabSizing(); + this.#keepTabSizeLocked = true; +- tab.group.collapsed = true; ++ tab.group.collapsed = !tab.group.hasAttribute("split-view-group"); + expandGroupOnDrop = true; + } + } @@ -913,6 +914,10 @@ } @@ -356,14 +365,16 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 let shiftSizeX = tabWidth * movingTabs.length; let shiftSizeY = tabHeight; dragData.tabWidth = tabWidth; -@@ -2375,11 +2408,15 @@ +@@ -2374,12 +2407,16 @@ + this.#clearDragOverCreateGroupTimer(); - let isPinned = draggedTab.pinned; +- let isPinned = draggedTab.pinned; - let numPinned = gBrowser.pinnedTabCount; - let tabs = this.ariaFocusableItems.slice( - isPinned ? 0 : numPinned, - isPinned ? numPinned : undefined ++ let isPinned = draggedTab?.group.pinned || draggedTab.pinned; + let numPinned = gBrowser._numVisiblePinTabsWithoutCollapsed; + let essential = draggedTab.hasAttribute("zen-essential"); + let tabs = this.ariaFocusableItems.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice( @@ -385,7 +396,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 let translateX = event.screenX - dragData.screenX; let translateY = event.screenY - dragData.screenY; -@@ -2407,6 +2444,12 @@ +@@ -2407,10 +2444,19 @@ let lastTab = tabs.at(-1); let lastMovingTab = movingTabs.at(-1); let firstMovingTab = movingTabs[0]; @@ -398,7 +409,24 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 let endEdge = ele => ele[screenAxis] + bounds(ele)[size]; let lastMovingTabScreen = endEdge(lastMovingTab); let firstMovingTabScreen = firstMovingTab[screenAxis]; -@@ -2568,6 +2611,9 @@ + let shiftSize = lastMovingTabScreen - firstMovingTabScreen; ++ if (firstMovingTab.hasAttribute("split-view-group")) { ++ shiftSize += 5; // A hack to allow more space for the group ++ } + let translate = screen - dragData[screenAxis]; + if (!isPinned) { + translate += +@@ -2431,6 +2477,9 @@ + // Shift the `.tab-group-label-container` to shift the label element. + item = item.parentElement; + } ++ if (item.parentElement?.hasAttribute("split-view-group")) { ++ item = item.parentElement; ++ } + item.style.transform = `${translateAxis}(${translate}px)`; + } + +@@ -2568,6 +2617,9 @@ break; } let element = tabs[mid]; @@ -408,7 +436,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 let elementForSize = isTabGroupLabel(element) ? element.parentElement : element; -@@ -2590,6 +2636,10 @@ +@@ -2590,6 +2642,10 @@ if (!dropElement) { dropElement = this.ariaFocusableItems[oldDropElementIndex]; } @@ -419,7 +447,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 let newDropElementIndex = dropElement ? dropElement.elementIndex : oldDropElementIndex; -@@ -2598,7 +2648,7 @@ +@@ -2598,7 +2654,7 @@ let shouldCreateGroupOnDrop; let dropBefore; if (dropElement) { @@ -428,7 +456,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 ? dropElement.parentElement : dropElement; -@@ -2660,12 +2710,12 @@ +@@ -2660,12 +2716,12 @@ } } @@ -443,7 +471,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 dropElement != draggedTab && isTab(dropElement) && !dropElement?.group && -@@ -2735,7 +2785,7 @@ +@@ -2735,7 +2791,7 @@ // Shift background tabs to leave a gap where the dragged tab // would currently be dropped. for (let item of tabs) { @@ -452,7 +480,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 continue; } -@@ -2744,6 +2794,9 @@ +@@ -2744,6 +2800,9 @@ if (isTabGroupLabel(item)) { // Shift the `.tab-group-label-container` to shift the label element. item = item.parentElement; @@ -462,7 +490,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 } item.style.transform = transform; } -@@ -2796,8 +2849,9 @@ +@@ -2796,8 +2855,9 @@ ); } @@ -474,7 +502,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 return; } -@@ -2809,6 +2863,12 @@ +@@ -2809,6 +2869,12 @@ item = item.parentElement; } item.style.transform = ""; @@ -487,7 +515,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 item.removeAttribute("dragover-createGroup"); } this.removeAttribute("movingtab-createGroup"); -@@ -2855,7 +2915,7 @@ +@@ -2855,7 +2921,7 @@ let postTransitionCleanup = () => { movingTab._moveTogetherSelectedTabsData.animate = false; }; @@ -496,7 +524,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 postTransitionCleanup(); } else { let onTransitionEnd = transitionendEvent => { -@@ -3028,7 +3088,7 @@ +@@ -3028,7 +3094,7 @@ } _notifyBackgroundTab(aTab) { @@ -505,3 +533,13 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..5ba36f48da0d85cf9be1abcd8d5446e1 return; } +@@ -3154,6 +3220,9 @@ + return null; + } + } ++ if (target?.group?.hasAttribute("split-view-group")) { ++ target = target.group.labelElement; ++ } + return target; + } + diff --git a/src/zen/common/styles/zen-theme.css b/src/zen/common/styles/zen-theme.css index f85cb0078..fa6a39329 100644 --- a/src/zen/common/styles/zen-theme.css +++ b/src/zen/common/styles/zen-theme.css @@ -163,7 +163,7 @@ @media (-moz-windows-mica) or (-moz-platform: macos) { background: transparent; --zen-themed-toolbar-bg-transparent: transparent; - @media -moz-pref("widget.windows.mica.toplevel-backdrop", 2) { + @media -moz-pref('widget.windows.mica.toplevel-backdrop', 2) { --zen-themed-toolbar-bg-transparent: color-mix(in srgb, var(--zen-themed-toolbar-bg) 35%, transparent 65%); } } diff --git a/src/zen/folders/zen-folders.css b/src/zen/folders/zen-folders.css index becd8985b..d82fff906 100644 --- a/src/zen/folders/zen-folders.css +++ b/src/zen/folders/zen-folders.css @@ -4,6 +4,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +tab-group { + & .tabbrowser-tab { + margin-inline-start: 0 !important; + } +} + tab-group[split-view-group] { display: flex; flex-wrap: nowrap; diff --git a/src/zen/glance/ZenGlanceManager.mjs b/src/zen/glance/ZenGlanceManager.mjs index 8de58928e..0daacefbb 100644 --- a/src/zen/glance/ZenGlanceManager.mjs +++ b/src/zen/glance/ZenGlanceManager.mjs @@ -271,7 +271,7 @@ this.closingGlance = true; this._animating = true; - gBrowser._insertTabAtIndex(this.#currentTab, { + gBrowser.zenInsertTabAtIndex(this.#currentTab, { index: this.getTabPosition(this.#currentParentTab), }); @@ -564,7 +564,7 @@ this.animatingFullOpen = true; this.#currentTab.setAttribute('zen-dont-split-glance', true); - gBrowser._insertTabAtIndex(this.#currentTab, { + gBrowser.zenInsertTabAtIndex(this.#currentTab, { index: this.getTabPosition(this.#currentTab), }); diff --git a/src/zen/tabs/ZenPinnedTabManager.mjs b/src/zen/tabs/ZenPinnedTabManager.mjs index 1f2f27450..471021932 100644 --- a/src/zen/tabs/ZenPinnedTabManager.mjs +++ b/src/zen/tabs/ZenPinnedTabManager.mjs @@ -332,7 +332,7 @@ } async _onTabMove(tab) { - if (!tab.pinned) { + if (!tab.pinned || !this._pinsCache) { return; } @@ -731,6 +731,18 @@ event.target.closest('#vertical-pinned-tabs-container') || event.target.closest('.zen-current-workspace-indicator'); const essentialTabsTarget = event.target.closest('#zen-essentials-container'); const tabsTarget = event.target.closest('#tabbrowser-arrowscrollbox'); + // Remove group labels from the moving tabs and replace it + // with the sub tabs + for (let i = 0; i < movingTabs.length; i++) { + const draggedTab = movingTabs[i]; + if (draggedTab.classList.contains('tab-group-label')) { + const group = draggedTab.group; + // remove label and add sub tabs to moving tabs + if (group) { + movingTabs.splice(i, 1, ...group.tabs); + } + } + } let isVertical = this.expandedSidebarMode; let moved = false; @@ -905,6 +917,7 @@ const tabsTarget = event.target.closest('#tabbrowser-arrowscrollbox'); let targetTab = event.target.closest('.tabbrowser-tab'); targetTab = targetTab?.group || targetTab; + draggedTab = draggedTab?.group?.hasAttribute('split-view-group') ? draggedTab.group : draggedTab; if (event.target.closest('.zen-current-workspace-indicator')) { this.removeTabContainersDragoverClass(); ZenWorkspaces.activeWorkspaceIndicator?.setAttribute('open', true);