From eedc5b73074c3035d1c5f3e8517ca7680661a955 Mon Sep 17 00:00:00 2001 From: "Mr. M" Date: Sat, 30 Aug 2025 15:00:20 +0200 Subject: [PATCH] fix: Fixed moving tabs to different workspaces, b=no-bug, c=common, folders, split-view, workspaces --- .../tabbrowser/content/tabbrowser-js.patch | 155 ++++++++++-------- src/zen/common/ZenUIManager.mjs | 2 +- src/zen/folders/ZenFolders.mjs | 1 + src/zen/split-view/ZenViewSplitter.mjs | 6 +- src/zen/workspaces/ZenWorkspaces.mjs | 14 +- 5 files changed, 101 insertions(+), 77 deletions(-) diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index 2bb325f71..fa3d24c5e 100644 --- a/src/browser/components/tabbrowser/content/tabbrowser-js.patch +++ b/src/browser/components/tabbrowser/content/tabbrowser-js.patch @@ -1,11 +1,15 @@ diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js -index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6fe685e62 100644 +index d80a66a01002e78a9c65545d08fe786328ddf124..a3f903c0245a9ac89def72c6ed1f4beed4c5079b 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js -@@ -422,15 +422,60 @@ +@@ -422,15 +422,64 @@ return this.tabContainer.visibleTabs; } ++ zenHandleTabMove(...args) { ++ return this.#handleTabMove(...args); ++ } ++ + get _numVisiblePinTabsWithoutCollapsed() { + let i = 0; + for (let item of this.tabContainer.ariaFocusableItems) { @@ -65,7 +69,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 set selectedTab(val) { if ( gSharedTabWarning.willShowSharedTabWarning(val) || -@@ -578,6 +623,7 @@ +@@ -578,6 +627,7 @@ this.tabpanels.appendChild(panel); let tab = this.tabs[0]; @@ -73,7 +77,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 tab.linkedPanel = uniqueId; this._selectedTab = tab; this._selectedBrowser = browser; -@@ -863,9 +909,13 @@ +@@ -863,9 +913,13 @@ } this.showTab(aTab); @@ -88,7 +92,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 aTab.setAttribute("pinned", "true"); this._updateTabBarForPinnedTabs(); -@@ -878,11 +928,15 @@ +@@ -878,11 +932,15 @@ } this.#handleTabMove(aTab, () => { @@ -105,7 +109,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 }); aTab.style.marginInlineStart = ""; -@@ -1060,6 +1114,8 @@ +@@ -1060,6 +1118,8 @@ let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"]; @@ -114,7 +118,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if ( aIconURL && !aLoadingPrincipal && -@@ -1070,6 +1126,9 @@ +@@ -1070,6 +1130,9 @@ ); return; } @@ -124,7 +128,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 let browser = this.getBrowserForTab(aTab); browser.mIconURL = aIconURL; -@@ -1319,6 +1378,7 @@ +@@ -1319,6 +1382,7 @@ if (!this._previewMode) { newTab.recordTimeFromUnloadToReload(); newTab.updateLastAccessed(); @@ -132,7 +136,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 oldTab.updateLastAccessed(); // if this is the foreground window, update the last-seen timestamps. if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) { -@@ -1471,6 +1531,9 @@ +@@ -1471,6 +1535,9 @@ } let activeEl = document.activeElement; @@ -142,7 +146,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 // If focus is on the old tab, move it to the new tab. if (activeEl == oldTab) { newTab.focus(); -@@ -1794,7 +1857,8 @@ +@@ -1794,7 +1861,8 @@ } _setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle, isURL } = {}) { @@ -152,7 +156,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 return false; } -@@ -1902,7 +1966,7 @@ +@@ -1902,7 +1970,7 @@ newIndex = this.selectedTab._tPos + 1; } @@ -161,7 +165,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if (this.isTabGroupLabel(targetTab)) { throw new Error( "Replacing a tab group label with a tab is not supported" -@@ -2166,6 +2230,7 @@ +@@ -2166,6 +2234,7 @@ uriIsAboutBlank, userContextId, skipLoad, @@ -169,7 +173,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } = {}) { let b = document.createXULElement("browser"); // Use the JSM global to create the permanentKey, so that if the -@@ -2239,8 +2304,7 @@ +@@ -2239,8 +2308,7 @@ // we use a different attribute name for this? b.setAttribute("name", name); } @@ -179,7 +183,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 b.setAttribute("transparent", "true"); } -@@ -2405,7 +2469,7 @@ +@@ -2405,7 +2473,7 @@ let panel = this.getPanel(browser); let uniqueId = this._generateUniquePanelID(); @@ -188,7 +192,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 aTab.linkedPanel = uniqueId; // Inject the into the DOM if necessary. -@@ -2464,8 +2528,8 @@ +@@ -2464,8 +2532,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) { @@ -199,7 +203,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } else { aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1; } -@@ -2629,7 +2693,6 @@ +@@ -2629,7 +2697,6 @@ this.selectedTab = this.addTrustedTab(BROWSER_NEW_TAB_URL, { tabIndex: tab._tPos + 1, userContextId: tab.userContextId, @@ -207,7 +211,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 focusUrlBar: true, }); resolve(this.selectedBrowser); -@@ -2709,6 +2772,8 @@ +@@ -2709,6 +2776,8 @@ schemelessInput, hasValidUserGestureActivation = false, textDirectiveUserActivation = false, @@ -216,7 +220,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } = {} ) { // all callers of addTab that pass a params object need to pass -@@ -2719,6 +2784,12 @@ +@@ -2719,6 +2788,12 @@ ); } @@ -229,7 +233,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if (!UserInteraction.running("browser.tabs.opening", window)) { UserInteraction.start("browser.tabs.opening", "initting", window); } -@@ -2782,6 +2853,19 @@ +@@ -2782,6 +2857,19 @@ noInitialLabel, skipBackgroundNotify, }); @@ -249,7 +253,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if (insertTab) { // Insert the tab into the tab container in the correct position. this.#insertTabAtIndex(t, { -@@ -2790,6 +2874,7 @@ +@@ -2790,6 +2878,7 @@ ownerTab, openerTab, pinned, @@ -257,7 +261,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 bulkOrderedOpen, tabGroup: tabGroup ?? openerTab?.group, }); -@@ -2808,6 +2893,7 @@ +@@ -2808,6 +2897,7 @@ openWindowInfo, skipLoad, triggeringRemoteType, @@ -265,7 +269,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 })); if (focusUrlBar) { -@@ -2928,6 +3014,12 @@ +@@ -2928,6 +3018,12 @@ } } @@ -278,7 +282,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 // Additionally send pinned tab events if (pinned) { this.#notifyPinnedStatus(t); -@@ -3016,10 +3108,10 @@ +@@ -3016,10 +3112,10 @@ isAdoptingGroup = false, isUserTriggered = false, telemetryUserCreateSource = "unknown", @@ -290,7 +294,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } if (!color) { -@@ -3040,9 +3132,14 @@ +@@ -3040,9 +3136,14 @@ label, isAdoptingGroup ); @@ -307,7 +311,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 ); group.addTabs(tabs); -@@ -3163,7 +3260,7 @@ +@@ -3163,7 +3264,7 @@ } this.#handleTabMove(tab, () => @@ -316,7 +320,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 ); } -@@ -3365,6 +3462,7 @@ +@@ -3365,6 +3466,7 @@ openWindowInfo, skipLoad, triggeringRemoteType, @@ -324,7 +328,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } ) { // If we don't have a preferred remote type (or it is `NOT_REMOTE`), and -@@ -3434,6 +3532,7 @@ +@@ -3434,6 +3536,7 @@ openWindowInfo, name, skipLoad, @@ -332,7 +336,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 }); } -@@ -3621,7 +3720,7 @@ +@@ -3621,7 +3724,7 @@ // Add a new tab if needed. if (!tab) { let createLazyBrowser = @@ -341,7 +345,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 let url = "about:blank"; if (tabData.entries?.length) { -@@ -3658,8 +3757,10 @@ +@@ -3658,8 +3761,10 @@ insertTab: false, skipLoad: true, preferredRemoteType, @@ -353,7 +357,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if (select) { tabToSelect = tab; } -@@ -3671,7 +3772,8 @@ +@@ -3671,7 +3776,8 @@ this.pinTab(tab); // Then ensure all the tab open/pinning information is sent. this._fireTabOpen(tab, {}); @@ -363,7 +367,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 let { groupId } = tabData; const tabGroup = tabGroupWorkingData.get(groupId); // if a tab refers to a tab group we don't know, skip any group -@@ -3685,7 +3787,10 @@ +@@ -3685,7 +3791,10 @@ tabGroup.stateData.id, tabGroup.stateData.color, tabGroup.stateData.collapsed, @@ -375,7 +379,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 ); tabsFragment.appendChild(tabGroup.node); } -@@ -3730,9 +3835,23 @@ +@@ -3730,9 +3839,23 @@ // to remove the old selected tab. if (tabToSelect) { let leftoverTab = this.selectedTab; @@ -391,15 +395,15 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 + gZenWorkspaces._initialTab._shouldRemove = true; + } + } - } ++ } + else { + gZenWorkspaces._tabToRemoveForEmpty = this.selectedTab; -+ } + } + this._hasAlreadyInitializedZenSessionStore = true; if (tabs.length > 1 || !tabs[0].selected) { this._updateTabsAfterInsert(); -@@ -3927,7 +4046,7 @@ +@@ -3927,7 +4050,7 @@ // Ensure we have an index if one was not provided. if (typeof elementIndex != "number" && typeof tabIndex != "number") { // Move the new tab after another tab if needed, to the end otherwise. @@ -408,7 +412,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if ( !bulkOrderedOpen && ((openerTab && -@@ -3939,7 +4058,7 @@ +@@ -3939,7 +4062,7 @@ let lastRelatedTab = openerTab && this._lastRelatedTabMap.get(openerTab); let previousTab = lastRelatedTab || openerTab || this.selectedTab; @@ -417,7 +421,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 tabGroup = previousTab.group; } if ( -@@ -3950,7 +4069,7 @@ +@@ -3950,7 +4073,7 @@ ) { elementIndex = Infinity; } else if (previousTab.visible) { @@ -426,7 +430,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } else if (previousTab == FirefoxViewHandler.tab) { elementIndex = 0; } -@@ -3978,14 +4097,14 @@ +@@ -3978,14 +4101,14 @@ } // Ensure index is within bounds. if (tab.pinned) { @@ -445,7 +449,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if (pinned && !itemAfter?.pinned) { itemAfter = null; -@@ -3996,7 +4115,7 @@ +@@ -3996,7 +4119,7 @@ this.tabContainer._invalidateCachedTabs(); @@ -454,7 +458,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 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); -@@ -4032,6 +4151,7 @@ +@@ -4032,6 +4155,7 @@ if (pinned) { this._updateTabBarForPinnedTabs(); } @@ -462,7 +466,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 TabBarVisibility.update(); } -@@ -4321,6 +4441,9 @@ +@@ -4321,6 +4445,9 @@ return; } @@ -472,7 +476,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 this.removeTabs(selectedTabs, { isUserTriggered, telemetrySource }); } -@@ -4582,6 +4705,7 @@ +@@ -4582,6 +4709,7 @@ telemetrySource, } = {} ) { @@ -480,7 +484,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 // When 'closeWindowWithLastTab' pref is enabled, closing all tabs // can be considered equivalent to closing the window. if ( -@@ -4671,6 +4795,7 @@ +@@ -4671,6 +4799,7 @@ if (lastToClose) { this.removeTab(lastToClose, aParams); } @@ -488,7 +492,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } catch (e) { console.error(e); } -@@ -4709,6 +4834,12 @@ +@@ -4709,6 +4838,12 @@ aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start(); } @@ -501,7 +505,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 // Handle requests for synchronously removing an already // asynchronously closing tab. if (!animate && aTab.closing) { -@@ -4723,6 +4854,9 @@ +@@ -4723,6 +4858,9 @@ // state). let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width; let isLastTab = this.#isLastTabInWindow(aTab); @@ -511,7 +515,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if ( !this._beginRemoveTab(aTab, { closeWindowFastpath: true, -@@ -4905,7 +5039,7 @@ +@@ -4905,7 +5043,7 @@ closeWindowWithLastTab != null ? closeWindowWithLastTab : !window.toolbar.visible || @@ -520,7 +524,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if (closeWindow) { // We've already called beforeunload on all the relevant tabs if we get here, -@@ -4929,6 +5063,7 @@ +@@ -4929,6 +5067,7 @@ newTab = true; } @@ -528,7 +532,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 aTab._endRemoveArgs = [closeWindow, newTab]; // swapBrowsersAndCloseOther will take care of closing the window without animation. -@@ -4969,13 +5104,7 @@ +@@ -4969,13 +5108,7 @@ aTab._mouseleave(); if (newTab) { @@ -543,7 +547,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } else { TabBarVisibility.update(); } -@@ -5108,6 +5237,7 @@ +@@ -5108,6 +5241,7 @@ this.tabs[i]._tPos = i; } @@ -551,7 +555,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if (!this._windowIsClosing) { // update tab close buttons state this.tabContainer._updateCloseButtons(); -@@ -5320,6 +5450,7 @@ +@@ -5320,6 +5454,7 @@ } let excludeTabs = new Set(aExcludeTabs); @@ -559,7 +563,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 // If this tab has a successor, it should be selectable, since // hiding or closing a tab removes that tab as a successor. -@@ -5332,13 +5463,13 @@ +@@ -5332,13 +5467,13 @@ !excludeTabs.has(aTab.owner) && Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose") ) { @@ -575,7 +579,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 ); let tab = this.tabContainer.findNextTab(aTab, { -@@ -5354,7 +5485,7 @@ +@@ -5354,7 +5489,7 @@ } if (tab) { @@ -584,7 +588,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } // If no qualifying visible tab was found, see if there is a tab in -@@ -5375,7 +5506,7 @@ +@@ -5375,7 +5510,7 @@ }); } @@ -593,7 +597,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } _blurTab(aTab) { -@@ -5777,10 +5908,10 @@ +@@ -5777,10 +5912,10 @@ SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); } @@ -606,7 +610,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 aTab.selected || aTab.closing || // Tabs that are sharing the screen, microphone or camera cannot be hidden. -@@ -5839,6 +5970,7 @@ +@@ -5839,6 +5974,7 @@ * @param {MozTabbrowserTab|MozTabbrowserTabGroup|MozTabbrowserTabGroup.labelElement} aTab */ replaceTabWithWindow(aTab, aOptions) { @@ -614,7 +618,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if (this.tabs.length == 1) { return null; } -@@ -5972,7 +6104,7 @@ +@@ -5972,7 +6108,7 @@ * `true` if element is a `` */ isTabGroup(element) { @@ -623,7 +627,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } /** -@@ -6048,8 +6180,8 @@ +@@ -6048,8 +6184,8 @@ } // Don't allow mixing pinned and unpinned tabs. @@ -634,7 +638,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } else { tabIndex = Math.max(tabIndex, this.pinnedTabCount); } -@@ -6075,10 +6207,16 @@ +@@ -6075,10 +6211,16 @@ this.#handleTabMove( element, () => { @@ -653,7 +657,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 if (neighbor && this.isTab(element) && tabIndex > element._tPos) { neighbor.after(element); } else { -@@ -6136,23 +6274,28 @@ +@@ -6136,23 +6278,28 @@ #moveTabNextTo(element, targetElement, moveBefore = false, metricsContext) { if (this.isTabGroupLabel(targetElement)) { targetElement = targetElement.group; @@ -688,7 +692,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } else if (!element.pinned && targetElement && targetElement.pinned) { // If the caller asks to move an unpinned element next to a pinned // tab, move the unpinned element to be the first unpinned element -@@ -6165,14 +6308,34 @@ +@@ -6165,14 +6312,34 @@ // move the tab group right before the first unpinned tab. // 4. Moving a tab group and the first unpinned tab is grouped: // move the tab group right before the first unpinned tab's tab group. @@ -724,7 +728,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 element.pinned ? this.tabContainer.pinnedTabsContainer : this.tabContainer; -@@ -6181,7 +6344,7 @@ +@@ -6181,7 +6348,7 @@ element, () => { if (moveBefore) { @@ -733,7 +737,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 } else if (targetElement) { targetElement.after(element); } else { -@@ -6227,10 +6390,10 @@ +@@ -6227,10 +6394,10 @@ * @param {TabMetricsContext} [metricsContext] */ moveTabToGroup(aTab, aGroup, metricsContext) { @@ -746,7 +750,24 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 return; } if (aTab.group && aTab.group.id === aGroup.id) { -@@ -6324,6 +6487,10 @@ +@@ -6261,6 +6428,7 @@ + + let state = { + tabIndex: tab._tPos, ++ workspaceId: tab.getAttribute("zen-workspace-id") + }; + if (tab.visible) { + state.elementIndex = tab.elementIndex; +@@ -6287,7 +6455,7 @@ + let changedTabGroup = + previousTabState.tabGroupId != currentTabState.tabGroupId; + +- if (changedPosition || changedTabGroup) { ++ if (changedPosition || changedTabGroup || (previousTabState.workspaceId != currentTabState.workspaceId)) { + tab.dispatchEvent( + new CustomEvent("TabMove", { + bubbles: true, +@@ -6324,6 +6492,10 @@ moveActionCallback(); @@ -757,7 +778,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 // Clear tabs cache after moving nodes because the order of tabs may have // changed. this.tabContainer._invalidateCachedTabs(); -@@ -7221,7 +7388,7 @@ +@@ -7221,7 +7393,7 @@ // preventDefault(). It will still raise the window if appropriate. break; } @@ -766,7 +787,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 window.focus(); aEvent.preventDefault(); break; -@@ -8166,6 +8333,7 @@ +@@ -8166,6 +8338,7 @@ aWebProgress.isTopLevel ) { this.mTab.setAttribute("busy", "true"); @@ -774,7 +795,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 gBrowser._tabAttrModified(this.mTab, ["busy"]); this.mTab._notselectedsinceload = !this.mTab.selected; } -@@ -9157,7 +9325,7 @@ var TabContextMenu = { +@@ -9157,7 +9330,7 @@ var TabContextMenu = { ); contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !this.multiselected; @@ -783,7 +804,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..c5c079ac5218f051407b27c6edbd4ba6 // Build Ask Chat items TabContextMenu.GenAI.buildTabMenu( document.getElementById("context_askChat"), -@@ -9476,6 +9644,7 @@ var TabContextMenu = { +@@ -9476,6 +9649,7 @@ var TabContextMenu = { ) ); } else { diff --git a/src/zen/common/ZenUIManager.mjs b/src/zen/common/ZenUIManager.mjs index 2c89216d7..0c9008a3c 100644 --- a/src/zen/common/ZenUIManager.mjs +++ b/src/zen/common/ZenUIManager.mjs @@ -132,7 +132,7 @@ var gZenUIManager = { }, updateTabsToolbar() { - const kUrlbarHeight = 336; + const kUrlbarHeight = 388; gURLBar.textbox.style.setProperty( '--zen-urlbar-top', `${window.innerHeight / 2 - Math.max(kUrlbarHeight, gURLBar.textbox.getBoundingClientRect().height) / 2}px` diff --git a/src/zen/folders/ZenFolders.mjs b/src/zen/folders/ZenFolders.mjs index 5d34419d6..2d123a518 100644 --- a/src/zen/folders/ZenFolders.mjs +++ b/src/zen/folders/ZenFolders.mjs @@ -466,6 +466,7 @@ ) ); }); + 1; animations.push(...this.updateFolderIcon(group)); const startMargin = -(heightUntilSelected + 4 * (selectedItems.length === 0 ? 1 : 0)); diff --git a/src/zen/split-view/ZenViewSplitter.mjs b/src/zen/split-view/ZenViewSplitter.mjs index 0ddb73747..49464588e 100644 --- a/src/zen/split-view/ZenViewSplitter.mjs +++ b/src/zen/split-view/ZenViewSplitter.mjs @@ -898,7 +898,7 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature { document.getElementById('context_zenSplitTabs').setAttribute('data-l10n-args', tabCountInfo); document .getElementById('context_zenSplitTabs') - .setAttribute('disabled', !this.contextCanSplitTabs()); + .setAttribute('hidden', !this.contextCanSplitTabs()); }); } @@ -907,14 +907,12 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature { */ insertSplitViewTabContextMenu() { const element = window.MozXULElement.parseXULToFragment(` - - `); - document.getElementById('context_closeDuplicateTabs').after(element); + document.getElementById('context_duplicateTab').before(element); } /** diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index c4ac55826..7d83bfe0a 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -1483,18 +1483,22 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature { continue; } - tab.setAttribute('zen-workspace-id', workspaceID); if (tab.hasAttribute('zen-essential')) { continue; } if (container && !justChangeId) { if (tab.group?.hasAttribute('split-view-group')) { - this.moveTabsToWorkspace(tab.group.tabs, workspaceID, true); - container.insertBefore(tab.group, container.lastChild); + gBrowser.zenHandleTabMove(tab.group, () => { + this.moveTabsToWorkspace(tab.group.tabs, workspaceID, true); + container.insertBefore(tab.group, container.lastChild); + }); continue; } - container.insertBefore(tab, container.lastChild); + gBrowser.zenHandleTabMove(tab, () => { + tab.setAttribute('zen-workspace-id', workspaceID); + container.insertBefore(tab, container.lastChild); + }); } // also change glance tab if it's the same tab const glanceTab = tab.querySelector('.tabbrowser-tab[zen-glance-tab]'); @@ -2626,7 +2630,7 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature { menu.appendChild(menuPopup); - document.getElementById('context_closeDuplicateTabs').after(menu); + document.getElementById('context_moveTabOptions').after(menu); } async changeTabWorkspace(workspaceID) {