1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-09 01:45:30 +02:00

Merge branch 'dev' of https://github.com/zen-browser/desktop into tab-folders

This commit is contained in:
mr. m 2025-05-24 21:29:01 +02:00
commit 4e9afda720
No known key found for this signature in database
GPG key ID: 419302196C23B258
140 changed files with 1710 additions and 1322 deletions

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e51fb618a 100644
index d5aa64842a35c6697263c63fd3a0571b64b01344..6943dc7f1d3d95ab1da315cbdbda0b032cf200f1 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -413,11 +413,41 @@
@ -253,7 +253,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
}
if (!color) {
@@ -3014,7 +3084,10 @@
@@ -3014,7 +3084,12 @@
label,
isAdoptingGroup
);
@ -265,7 +265,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
group,
insertBefore?.group ?? insertBefore
);
@@ -3303,6 +3376,7 @@
@@ -3303,6 +3378,7 @@
openWindowInfo,
skipLoad,
triggeringRemoteType,
@ -273,7 +273,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
}
) {
// If we don't have a preferred remote type (or it is `NOT_REMOTE`), and
@@ -3372,6 +3446,7 @@
@@ -3372,6 +3448,7 @@
openWindowInfo,
name,
skipLoad,
@ -281,7 +281,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
});
}
@@ -3560,7 +3635,7 @@
@@ -3560,7 +3637,7 @@
// Add a new tab if needed.
if (!tab) {
let createLazyBrowser =
@ -290,7 +290,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
let url = "about:blank";
if (tabData.entries?.length) {
@@ -3598,7 +3673,29 @@
@@ -3598,7 +3675,29 @@
skipLoad: true,
preferredRemoteType,
});
@ -320,7 +320,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
if (select) {
tabToSelect = tab;
}
@@ -3622,7 +3719,8 @@
@@ -3622,7 +3721,8 @@
// needs calling:
shouldUpdateForPinnedTabs = true;
}
@ -330,7 +330,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
let { groupId } = tabData;
const tabGroup = tabGroupWorkingData.get(groupId);
// if a tab refers to a tab group we don't know, skip any group
@@ -3636,7 +3734,10 @@
@@ -3636,7 +3736,10 @@
tabGroup.stateData.id,
tabGroup.stateData.color,
tabGroup.stateData.collapsed,
@ -342,7 +342,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
);
tabsFragment.appendChild(tabGroup.node);
}
@@ -3684,8 +3785,16 @@
@@ -3684,8 +3787,16 @@
// to remove the old selected tab.
if (tabToSelect) {
let leftoverTab = this.selectedTab;
@ -361,7 +361,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
}
if (tabs.length > 1 || !tabs[0].selected) {
@@ -3881,7 +3990,7 @@
@@ -3881,7 +3992,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.
@ -370,7 +370,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
if (
!bulkOrderedOpen &&
((openerTab &&
@@ -3904,7 +4013,7 @@
@@ -3904,7 +4015,7 @@
) {
elementIndex = Infinity;
} else if (previousTab.visible) {
@ -379,7 +379,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
} else if (previousTab == FirefoxViewHandler.tab) {
elementIndex = 0;
}
@@ -3932,10 +4041,10 @@
@@ -3932,10 +4043,10 @@
}
// Ensure index is within bounds.
if (tab.pinned) {
@ -393,7 +393,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
index = Math.min(index, allItems.length);
}
/** @type {MozTabbrowserTab|undefined} */
@@ -3947,7 +4056,7 @@
@@ -3947,7 +4058,7 @@
this.tabContainer._invalidateCachedTabs();
@ -402,7 +402,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
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);
@@ -4268,6 +4377,9 @@
@@ -4268,6 +4379,9 @@
return;
}
@ -412,7 +412,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
this.removeTabs(selectedTabs, { telemetrySource });
}
@@ -4520,6 +4632,7 @@
@@ -4520,6 +4634,7 @@
telemetrySource,
} = {}
) {
@ -420,7 +420,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs
// can be considered equivalent to closing the window.
if (
@@ -4604,6 +4717,7 @@
@@ -4604,6 +4719,7 @@
if (lastToClose) {
this.removeTab(lastToClose, aParams);
}
@ -428,7 +428,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
} catch (e) {
console.error(e);
}
@@ -4641,6 +4755,12 @@
@@ -4641,6 +4757,12 @@
aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start();
}
@ -441,7 +441,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate && aTab.closing) {
@@ -4655,7 +4775,9 @@
@@ -4655,7 +4777,9 @@
// frame created for it (for example, by updating the visually selected
// state).
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
@ -452,7 +452,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
if (
!this._beginRemoveTab(aTab, {
closeWindowFastpath: true,
@@ -4821,7 +4943,7 @@
@@ -4821,7 +4945,7 @@
closeWindowWithLastTab != null
? closeWindowWithLastTab
: !window.toolbar.visible ||
@ -461,7 +461,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
@@ -4845,6 +4967,7 @@
@@ -4845,6 +4969,7 @@
newTab = true;
}
@ -469,7 +469,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
aTab._endRemoveArgs = [closeWindow, newTab];
// swapBrowsersAndCloseOther will take care of closing the window without animation.
@@ -4885,9 +5008,7 @@
@@ -4885,9 +5010,7 @@
aTab._mouseleave();
if (newTab) {
@ -480,7 +480,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
} else {
TabBarVisibility.update();
}
@@ -5016,6 +5137,8 @@
@@ -5016,6 +5139,8 @@
this.tabs[i]._tPos = i;
}
@ -489,7 +489,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
if (!this._windowIsClosing) {
if (wasPinned) {
this.tabContainer._positionPinnedTabs();
@@ -5230,6 +5353,7 @@
@@ -5230,6 +5355,7 @@
}
let excludeTabs = new Set(aExcludeTabs);
@ -497,7 +497,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
// If this tab has a successor, it should be selectable, since
// hiding or closing a tab removes that tab as a successor.
@@ -5242,13 +5366,13 @@
@@ -5242,13 +5368,13 @@
!excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
) {
@ -513,7 +513,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
);
let tab = this.tabContainer.findNextTab(aTab, {
@@ -5264,7 +5388,7 @@
@@ -5264,7 +5390,7 @@
}
if (tab) {
@ -522,7 +522,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
}
// If no qualifying visible tab was found, see if there is a tab in
@@ -5285,7 +5409,7 @@
@@ -5285,7 +5411,7 @@
});
}
@ -531,7 +531,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
}
_blurTab(aTab) {
@@ -5686,10 +5810,10 @@
@@ -5686,10 +5812,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
@ -544,16 +544,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -5909,7 +6033,7 @@
* `true` if element is a `<tab-group>`
*/
isTabGroup(element) {
- return !!(element?.tagName == "tab-group");
+ return !!(element?.tagName == "tab-group" || element?.tagName == "zen-folder");
}
/**
@@ -5986,7 +6110,7 @@
@@ -5986,7 +6112,7 @@
// Don't allow mixing pinned and unpinned tabs.
if (this.isTab(element) && element.pinned) {
@ -562,7 +553,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
} else {
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
}
@@ -6012,10 +6136,16 @@
@@ -6012,10 +6138,16 @@
this.#handleTabMove(
element,
() => {
@ -581,7 +572,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
neighbor.after(element);
} else {
@@ -6084,17 +6214,26 @@
@@ -6084,17 +6216,26 @@
targetElement = targetElement.group;
}
}
@ -611,7 +602,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
if (element.pinned && this.tabContainer.verticalMode) {
return this.tabContainer.verticalPinnedTabsContainer;
}
@@ -6154,7 +6293,7 @@
@@ -6154,7 +6295,7 @@
if (!this.isTab(aTab)) {
throw new Error("Can only move a tab into a tab group");
}
@ -620,7 +611,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
return;
}
if (aTab.group && aTab.group.id === aGroup.id) {
@@ -6248,6 +6387,10 @@
@@ -6248,6 +6389,10 @@
moveActionCallback();
@ -631,7 +622,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
// Clear tabs cache after moving nodes because the order of tabs may have
// changed.
this.tabContainer._invalidateCachedTabs();
@@ -7145,7 +7288,7 @@
@@ -7145,7 +7290,7 @@
// preventDefault(). It will still raise the window if appropriate.
break;
}
@ -640,7 +631,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
window.focus();
aEvent.preventDefault();
break;
@@ -8044,6 +8187,7 @@
@@ -8044,6 +8189,7 @@
aWebProgress.isTopLevel
) {
this.mTab.setAttribute("busy", "true");
@ -648,7 +639,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected;
}
@@ -9009,7 +9153,7 @@ var TabContextMenu = {
@@ -9009,7 +9155,7 @@ var TabContextMenu = {
);
contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !this.multiselected;
@ -657,7 +648,7 @@ index d5aa64842a35c6697263c63fd3a0571b64b01344..f44e217b5a104d16d9a76c80adced54e
// Move Tab items
let contextMoveTabOptions = document.getElementById(
"context_moveTabOptions"
@@ -9278,6 +9422,7 @@ var TabContextMenu = {
@@ -9278,6 +9424,7 @@ var TabContextMenu = {
telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP,
});
} else {