mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-21 17:21:56 +00:00
Added support for split views persisting between sessions
This commit is contained in:
@@ -58,6 +58,11 @@ tab-group[split-view-group] {
|
|||||||
right: 50%;
|
right: 50%;
|
||||||
transform: translateX(50%);
|
transform: translateX(50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .tab-content {
|
||||||
|
min-width: 0;
|
||||||
|
justify-content: unset !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:has(> tab:is([visuallyselected], [multiselected])) {
|
&:has(> tab:is([visuallyselected], [multiselected])) {
|
||||||
|
@@ -365,7 +365,7 @@ menuitem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
& .zen-toast {
|
& .zen-toast {
|
||||||
padding: 0.9rem 0.8rem;
|
padding: 0.5rem 0.6rem;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
170deg,
|
170deg,
|
||||||
|
@@ -1722,6 +1722,33 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storeDataForSessionStore() {
|
||||||
|
// We cant store any tab or browser elements in the session store
|
||||||
|
// so we need to store the tab indexes and group indexes
|
||||||
|
const data = this._data.map((group) => {
|
||||||
|
return {
|
||||||
|
groupId: group.tabs[0].group?.id,
|
||||||
|
gridType: group.gridType,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
restoreDataFromSessionStore(data) {
|
||||||
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// We can just get the tab group with document.getElementById(group.groupId)
|
||||||
|
// and add the tabs to it
|
||||||
|
for (const group of data) {
|
||||||
|
const groupElement = document.getElementById(group.groupId);
|
||||||
|
if (groupElement) {
|
||||||
|
const tabs = groupElement.querySelectorAll('tab');
|
||||||
|
this.splitTabs([...tabs], group.gridType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.gZenViewSplitter = new ZenViewSplitter();
|
window.gZenViewSplitter = new ZenViewSplitter();
|
||||||
|
@@ -263,12 +263,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
_organizeTabsToWorkspaceSections(workspace, section, pinnedSection, tabs) {
|
_organizeTabsToWorkspaceSections(workspace, section, pinnedSection, tabs) {
|
||||||
const workspaceTabs = Array.from(tabs).filter((tab) => tab.getAttribute('zen-workspace-id') === workspace.uuid);
|
const workspaceTabs = Array.from(tabs).filter((tab) => tab.getAttribute('zen-workspace-id') === workspace.uuid);
|
||||||
let firstNormalTab = null;
|
let firstNormalTab = null;
|
||||||
for (const tab of workspaceTabs) {
|
for (let tab of workspaceTabs) {
|
||||||
if (tab.hasAttribute('zen-essential')) {
|
if (tab.hasAttribute('zen-essential')) {
|
||||||
continue; // Ignore essentials as they need to be in their own section
|
continue; // Ignore essentials as they need to be in their own section
|
||||||
}
|
}
|
||||||
// remove tab from list
|
// remove tab from list
|
||||||
tabs.splice(tabs.indexOf(tab), 1);
|
tabs.splice(tabs.indexOf(tab), 1);
|
||||||
|
tab = tab.group ?? tab;
|
||||||
if (tab.pinned) {
|
if (tab.pinned) {
|
||||||
pinnedSection.insertBefore(tab, pinnedSection.nextSibling);
|
pinnedSection.insertBefore(tab, pinnedSection.nextSibling);
|
||||||
} else {
|
} else {
|
||||||
@@ -2323,6 +2324,23 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
return this._allStoredTabs;
|
return this._allStoredTabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get allTabGroups() {
|
||||||
|
if (!this._hasInitializedTabsStrip) {
|
||||||
|
let children = this.tabboxChildren;
|
||||||
|
return children.filter((node) => node.tagName == 'tab-group');
|
||||||
|
}
|
||||||
|
const pinnedContainers = document.querySelectorAll('#vertical-pinned-tabs-container .zen-workspace-tabs-section');
|
||||||
|
const normalContainers = document.querySelectorAll('#tabbrowser-arrowscrollbox .zen-workspace-tabs-section');
|
||||||
|
const containers = [...pinnedContainers, ...normalContainers];
|
||||||
|
const tabGroups = [];
|
||||||
|
for (const container of containers) {
|
||||||
|
for (const tabGroup of container.querySelectorAll('tab-group')) {
|
||||||
|
tabGroups.push(tabGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tabGroups;
|
||||||
|
}
|
||||||
|
|
||||||
get allUsedBrowsers() {
|
get allUsedBrowsers() {
|
||||||
if (!this._hasInitializedTabsStrip) {
|
if (!this._hasInitializedTabsStrip) {
|
||||||
return gBrowser.browsers;
|
return gBrowser.browsers;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
|
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||||
index f814772114948f87cbb3c3a7231c95ea1f68d776..ae35daa518ca25f4fc95ef983519c390bf088a68 100644
|
index f814772114948f87cbb3c3a7231c95ea1f68d776..ee358a46956d5f09983fa98a202085bac69c8b27 100644
|
||||||
--- a/browser/components/sessionstore/SessionStore.sys.mjs
|
--- a/browser/components/sessionstore/SessionStore.sys.mjs
|
||||||
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
|
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||||
@@ -3171,7 +3171,7 @@ var SessionStoreInternal = {
|
@@ -3171,7 +3171,7 @@ var SessionStoreInternal = {
|
||||||
@@ -19,7 +19,7 @@ index f814772114948f87cbb3c3a7231c95ea1f68d776..ae35daa518ca25f4fc95ef983519c390
|
|||||||
|
|
||||||
if (inBackground === false) {
|
if (inBackground === false) {
|
||||||
aWindow.gBrowser.selectedTab = newTab;
|
aWindow.gBrowser.selectedTab = newTab;
|
||||||
@@ -5355,14 +5356,14 @@ var SessionStoreInternal = {
|
@@ -5355,14 +5356,15 @@ var SessionStoreInternal = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let tabbrowser = aWindow.gBrowser;
|
let tabbrowser = aWindow.gBrowser;
|
||||||
@@ -29,6 +29,7 @@ index f814772114948f87cbb3c3a7231c95ea1f68d776..ae35daa518ca25f4fc95ef983519c390
|
|||||||
let winData = this._windows[aWindow.__SSi];
|
let winData = this._windows[aWindow.__SSi];
|
||||||
let tabsData = (winData.tabs = []);
|
let tabsData = (winData.tabs = []);
|
||||||
|
|
||||||
|
+ winData.splitViewData = aWindow.gZenViewSplitter?.storeDataForSessionStore();
|
||||||
// update the internal state data for this window
|
// update the internal state data for this window
|
||||||
for (let tab of tabs) {
|
for (let tab of tabs) {
|
||||||
- if (tab == aWindow.FirefoxViewHandler.tab) {
|
- if (tab == aWindow.FirefoxViewHandler.tab) {
|
||||||
@@ -36,7 +37,7 @@ index f814772114948f87cbb3c3a7231c95ea1f68d776..ae35daa518ca25f4fc95ef983519c390
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let tabData = lazy.TabState.collect(tab, TAB_CUSTOM_VALUES.get(tab));
|
let tabData = lazy.TabState.collect(tab, TAB_CUSTOM_VALUES.get(tab));
|
||||||
@@ -5381,7 +5382,7 @@ var SessionStoreInternal = {
|
@@ -5381,7 +5383,7 @@ var SessionStoreInternal = {
|
||||||
// We don't store the Firefox View tab in Session Store, so if it was the last selected "tab" when
|
// We don't store the Firefox View tab in Session Store, so if it was the last selected "tab" when
|
||||||
// a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab,
|
// a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab,
|
||||||
// since it's only inserted into the tab strip after it's selected).
|
// since it's only inserted into the tab strip after it's selected).
|
||||||
@@ -45,7 +46,26 @@ index f814772114948f87cbb3c3a7231c95ea1f68d776..ae35daa518ca25f4fc95ef983519c390
|
|||||||
selectedIndex = 1;
|
selectedIndex = 1;
|
||||||
winData.title = tabbrowser.tabs[0].label;
|
winData.title = tabbrowser.tabs[0].label;
|
||||||
}
|
}
|
||||||
@@ -6086,8 +6087,23 @@ var SessionStoreInternal = {
|
@@ -5538,6 +5540,7 @@ var SessionStoreInternal = {
|
||||||
|
winData.tabs,
|
||||||
|
winData.groups ?? []
|
||||||
|
);
|
||||||
|
+ aWindow.gZenViewSplitter?.restoreDataFromSessionStore(winData.splitViewData);
|
||||||
|
this._log.debug(
|
||||||
|
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
|
||||||
|
);
|
||||||
|
@@ -5933,8 +5936,8 @@ var SessionStoreInternal = {
|
||||||
|
let isRemotenessUpdate = options.isRemotenessUpdate;
|
||||||
|
|
||||||
|
let willRestoreImmediately =
|
||||||
|
- options.restoreImmediately || tabbrowser.selectedBrowser == browser;
|
||||||
|
-
|
||||||
|
+ options.restoreImmediately || tabbrowser.selectedBrowser == browser
|
||||||
|
+ || (tabbrowser.selectedTab.group?.id == tab.group?.id);
|
||||||
|
let isBrowserInserted = browser.isConnected;
|
||||||
|
|
||||||
|
// Increase the busy state counter before modifying the tab.
|
||||||
|
@@ -6086,8 +6089,23 @@ var SessionStoreInternal = {
|
||||||
|
|
||||||
// Most of tabData has been restored, now continue with restoring
|
// Most of tabData has been restored, now continue with restoring
|
||||||
// attributes that may trigger external events.
|
// attributes that may trigger external events.
|
||||||
|
@@ -0,0 +1,14 @@
|
|||||||
|
diff --git a/browser/components/sessionstore/TabGroupState.sys.mjs b/browser/components/sessionstore/TabGroupState.sys.mjs
|
||||||
|
index 2406837c67d8ff590aa0db6c75ede81e53097506..b69fb7862cd76c891ef61e29aca8c10bab2f5d7e 100644
|
||||||
|
--- a/browser/components/sessionstore/TabGroupState.sys.mjs
|
||||||
|
+++ b/browser/components/sessionstore/TabGroupState.sys.mjs
|
||||||
|
@@ -66,6 +66,9 @@ class _TabGroupState {
|
||||||
|
name: tabGroup.label,
|
||||||
|
color: tabGroup.color,
|
||||||
|
collapsed: tabGroup.collapsed,
|
||||||
|
+ pinned: tabGroup.pinned,
|
||||||
|
+ essential: tabGroup.essential,
|
||||||
|
+ splitView: tabGroup.hasAttribute("split-view-group"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@@ -1,13 +1,8 @@
|
|||||||
diff --git a/browser/components/sessionstore/TabState.sys.mjs b/browser/components/sessionstore/TabState.sys.mjs
|
diff --git a/browser/components/sessionstore/TabState.sys.mjs b/browser/components/sessionstore/TabState.sys.mjs
|
||||||
index 8f7ed557e6aa61e7e16ed4a8d785ad5fe651b3d8..aff63696d198055886960072a6130318e099ae42 100644
|
index 8f7ed557e6aa61e7e16ed4a8d785ad5fe651b3d8..254849e13f7566029dc780c45e376e0f0d427cb5 100644
|
||||||
--- a/browser/components/sessionstore/TabState.sys.mjs
|
--- a/browser/components/sessionstore/TabState.sys.mjs
|
||||||
+++ b/browser/components/sessionstore/TabState.sys.mjs
|
+++ b/browser/components/sessionstore/TabState.sys.mjs
|
||||||
@@ -80,10 +80,20 @@ class _TabState {
|
@@ -84,6 +84,16 @@ class _TabState {
|
||||||
tabData.muteReason = tab.muteReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (tab.group) {
|
|
||||||
+ if (tab.group && !tab.group.hasAttribute("split-view-group")) {
|
|
||||||
tabData.groupId = tab.group.id;
|
tabData.groupId = tab.group.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63af1fa8a3 100644
|
index 628aa6596627c85efe361fc1ece8fd58f7ee653e..2a9ac30c7e270586ff4502046e5b1ae7409d0582 100644
|
||||||
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
@@ -412,11 +412,50 @@
|
@@ -412,11 +412,50 @@
|
||||||
@@ -246,7 +246,24 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
// Additionally send pinned tab events
|
// Additionally send pinned tab events
|
||||||
if (pinned) {
|
if (pinned) {
|
||||||
this._notifyPinnedStatus(t);
|
this._notifyPinnedStatus(t);
|
||||||
@@ -2904,6 +2977,7 @@
|
@@ -2865,12 +2938,15 @@
|
||||||
|
* @param {string} [label=]
|
||||||
|
* @returns {MozTabbrowserTabGroup}
|
||||||
|
*/
|
||||||
|
- _createTabGroup(id, color, collapsed, label = "") {
|
||||||
|
+ _createTabGroup(id, color, collapsed, label = "", pinned = false, essential = false, splitViewGroup = false) {
|
||||||
|
let group = document.createXULElement("tab-group", { is: "tab-group" });
|
||||||
|
group.id = id;
|
||||||
|
group.collapsed = collapsed;
|
||||||
|
group.color = color;
|
||||||
|
group.label = label;
|
||||||
|
+ group.pinned = pinned;
|
||||||
|
+ group.essential = essential;
|
||||||
|
+ if (splitViewGroup) group.setAttribute('split-view-group', true);
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2904,6 +2980,7 @@
|
||||||
label = "",
|
label = "",
|
||||||
insertBefore = null,
|
insertBefore = null,
|
||||||
showCreateUI = false,
|
showCreateUI = false,
|
||||||
@@ -254,7 +271,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
if (!tabs?.length) {
|
if (!tabs?.length) {
|
||||||
@@ -2918,7 +2992,12 @@
|
@@ -2918,7 +2995,12 @@
|
||||||
id = `${Date.now()}-${Math.round(Math.random() * 100)}`;
|
id = `${Date.now()}-${Math.round(Math.random() * 100)}`;
|
||||||
}
|
}
|
||||||
let group = this._createTabGroup(id, color, false, label);
|
let group = this._createTabGroup(id, color, false, label);
|
||||||
@@ -264,11 +281,11 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
+ }
|
+ }
|
||||||
+ group.essential = tabs.some(tab => tab.hasAttribute("essential"));
|
+ group.essential = tabs.some(tab => tab.hasAttribute("essential"));
|
||||||
+ group.pinned = group.essential || tabs.some(tab => tab.pinned);
|
+ group.pinned = group.essential || tabs.some(tab => tab.pinned);
|
||||||
+ (group.essential ? document.getElementById("zen-essentials-container") : (group.pinned ? this.verticalPinnedTabsContainer : this.tabContainer)).insertBefore(
|
+ ((insertBefore?.group ?? insertBefore).parentNode).insertBefore(
|
||||||
group,
|
group,
|
||||||
insertBefore?.group ?? insertBefore
|
insertBefore?.group ?? insertBefore
|
||||||
);
|
);
|
||||||
@@ -3126,6 +3205,7 @@
|
@@ -3126,6 +3208,7 @@
|
||||||
initialBrowsingContextGroupId,
|
initialBrowsingContextGroupId,
|
||||||
openWindowInfo,
|
openWindowInfo,
|
||||||
skipLoad,
|
skipLoad,
|
||||||
@@ -276,7 +293,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
// If we don't have a preferred remote type, and we have a remote
|
// If we don't have a preferred remote type, and we have a remote
|
||||||
@@ -3189,6 +3269,7 @@
|
@@ -3189,6 +3272,7 @@
|
||||||
openWindowInfo,
|
openWindowInfo,
|
||||||
name,
|
name,
|
||||||
skipLoad,
|
skipLoad,
|
||||||
@@ -284,7 +301,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3367,6 +3448,27 @@
|
@@ -3367,6 +3451,27 @@
|
||||||
) {
|
) {
|
||||||
tabWasReused = true;
|
tabWasReused = true;
|
||||||
tab = this.selectedTab;
|
tab = this.selectedTab;
|
||||||
@@ -312,7 +329,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
if (!tabData.pinned) {
|
if (!tabData.pinned) {
|
||||||
this.unpinTab(tab);
|
this.unpinTab(tab);
|
||||||
} else {
|
} else {
|
||||||
@@ -3380,6 +3482,7 @@
|
@@ -3380,6 +3485,7 @@
|
||||||
restoreTabsLazily && !select && !tabData.pinned;
|
restoreTabsLazily && !select && !tabData.pinned;
|
||||||
|
|
||||||
let url = "about:blank";
|
let url = "about:blank";
|
||||||
@@ -320,7 +337,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
if (tabData.entries?.length) {
|
if (tabData.entries?.length) {
|
||||||
let activeIndex = (tabData.index || tabData.entries.length) - 1;
|
let activeIndex = (tabData.index || tabData.entries.length) - 1;
|
||||||
// Ensure the index is in bounds.
|
// Ensure the index is in bounds.
|
||||||
@@ -3415,7 +3518,27 @@
|
@@ -3415,7 +3521,27 @@
|
||||||
skipLoad: true,
|
skipLoad: true,
|
||||||
preferredRemoteType,
|
preferredRemoteType,
|
||||||
});
|
});
|
||||||
@@ -349,7 +366,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
if (select) {
|
if (select) {
|
||||||
tabToSelect = tab;
|
tabToSelect = tab;
|
||||||
}
|
}
|
||||||
@@ -3428,8 +3551,8 @@
|
@@ -3428,8 +3554,8 @@
|
||||||
// inserted in the DOM. If the tab is not yet in the DOM,
|
// inserted in the DOM. If the tab is not yet in the DOM,
|
||||||
// just insert it in the right place from the start.
|
// just insert it in the right place from the start.
|
||||||
if (!tab.parentNode) {
|
if (!tab.parentNode) {
|
||||||
@@ -360,7 +377,29 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
tab.toggleAttribute("pinned", true);
|
tab.toggleAttribute("pinned", true);
|
||||||
this.tabContainer._invalidateCachedTabs();
|
this.tabContainer._invalidateCachedTabs();
|
||||||
// Then ensure all the tab open/pinning information is sent.
|
// Then ensure all the tab open/pinning information is sent.
|
||||||
@@ -3504,6 +3627,9 @@
|
@@ -3439,7 +3565,8 @@
|
||||||
|
// needs calling:
|
||||||
|
shouldUpdateForPinnedTabs = true;
|
||||||
|
}
|
||||||
|
- } else if (tabData.groupId) {
|
||||||
|
+ }
|
||||||
|
+ if (tabData.groupId) {
|
||||||
|
let { groupId } = tabData;
|
||||||
|
const tabGroup = tabGroupWorkingData.get(groupId);
|
||||||
|
// if a tab refers to a tab group we don't know, skip any group
|
||||||
|
@@ -3453,7 +3580,10 @@
|
||||||
|
tabGroup.stateData.id,
|
||||||
|
tabGroup.stateData.color,
|
||||||
|
tabGroup.stateData.collapsed,
|
||||||
|
- tabGroup.stateData.name
|
||||||
|
+ tabGroup.stateData.name,
|
||||||
|
+ tabGroup.stateData.pinned,
|
||||||
|
+ tabGroup.stateData.essential,
|
||||||
|
+ tabGroup.stateData.splitView,
|
||||||
|
);
|
||||||
|
tabsFragment.appendChild(tabGroup.node);
|
||||||
|
}
|
||||||
|
@@ -3504,6 +3634,9 @@
|
||||||
this.selectedTab = tabToSelect;
|
this.selectedTab = tabToSelect;
|
||||||
this.removeTab(leftoverTab);
|
this.removeTab(leftoverTab);
|
||||||
}
|
}
|
||||||
@@ -370,7 +409,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
|
|
||||||
if (tabs.length > 1 || !tabs[0].selected) {
|
if (tabs.length > 1 || !tabs[0].selected) {
|
||||||
this._updateTabsAfterInsert();
|
this._updateTabsAfterInsert();
|
||||||
@@ -3693,7 +3819,7 @@
|
@@ -3693,7 +3826,7 @@
|
||||||
// Ensure we have an index if one was not provided.
|
// Ensure we have an index if one was not provided.
|
||||||
if (typeof index != "number") {
|
if (typeof index != "number") {
|
||||||
// Move the new tab after another tab if needed, to the end otherwise.
|
// Move the new tab after another tab if needed, to the end otherwise.
|
||||||
@@ -379,7 +418,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
if (
|
if (
|
||||||
!bulkOrderedOpen &&
|
!bulkOrderedOpen &&
|
||||||
((openerTab &&
|
((openerTab &&
|
||||||
@@ -3736,18 +3862,18 @@
|
@@ -3736,18 +3869,18 @@
|
||||||
|
|
||||||
// Ensure index is within bounds.
|
// Ensure index is within bounds.
|
||||||
if (tab.pinned) {
|
if (tab.pinned) {
|
||||||
@@ -402,7 +441,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
if (tabAfter && tabAfter.group == tabGroup) {
|
if (tabAfter && tabAfter.group == tabGroup) {
|
||||||
// Place at the front of, or between tabs in, the same tab group
|
// Place at the front of, or between tabs in, the same tab group
|
||||||
this.tabContainer.insertBefore(tab, tabAfter);
|
this.tabContainer.insertBefore(tab, tabAfter);
|
||||||
@@ -4059,6 +4185,9 @@
|
@@ -4059,6 +4192,9 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +451,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
this.removeTabs(selectedTabs);
|
this.removeTabs(selectedTabs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4391,6 +4520,7 @@
|
@@ -4391,6 +4527,7 @@
|
||||||
skipSessionStore,
|
skipSessionStore,
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
@@ -420,7 +459,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
if (UserInteraction.running("browser.tabs.opening", window)) {
|
if (UserInteraction.running("browser.tabs.opening", window)) {
|
||||||
UserInteraction.finish("browser.tabs.opening", window);
|
UserInteraction.finish("browser.tabs.opening", window);
|
||||||
}
|
}
|
||||||
@@ -4407,6 +4537,12 @@
|
@@ -4407,6 +4544,12 @@
|
||||||
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,7 +472,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
// Handle requests for synchronously removing an already
|
// Handle requests for synchronously removing an already
|
||||||
// asynchronously closing tab.
|
// asynchronously closing tab.
|
||||||
if (!animate && aTab.closing) {
|
if (!animate && aTab.closing) {
|
||||||
@@ -4421,7 +4557,9 @@
|
@@ -4421,7 +4564,9 @@
|
||||||
// frame created for it (for example, by updating the visually selected
|
// frame created for it (for example, by updating the visually selected
|
||||||
// state).
|
// state).
|
||||||
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
|
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
|
||||||
@@ -444,7 +483,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
if (
|
if (
|
||||||
!this._beginRemoveTab(aTab, {
|
!this._beginRemoveTab(aTab, {
|
||||||
closeWindowFastpath: true,
|
closeWindowFastpath: true,
|
||||||
@@ -4435,7 +4573,6 @@
|
@@ -4435,7 +4580,6 @@
|
||||||
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -452,7 +491,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
let lockTabSizing =
|
let lockTabSizing =
|
||||||
!this.tabContainer.verticalMode &&
|
!this.tabContainer.verticalMode &&
|
||||||
!aTab.pinned &&
|
!aTab.pinned &&
|
||||||
@@ -4574,14 +4711,14 @@
|
@@ -4574,14 +4718,14 @@
|
||||||
!!this.tabsInCollapsedTabGroups.length;
|
!!this.tabsInCollapsedTabGroups.length;
|
||||||
if (
|
if (
|
||||||
aTab.visible &&
|
aTab.visible &&
|
||||||
@@ -469,7 +508,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
|
|
||||||
if (closeWindow) {
|
if (closeWindow) {
|
||||||
// We've already called beforeunload on all the relevant tabs if we get here,
|
// We've already called beforeunload on all the relevant tabs if we get here,
|
||||||
@@ -4605,6 +4742,7 @@
|
@@ -4605,6 +4749,7 @@
|
||||||
|
|
||||||
newTab = true;
|
newTab = true;
|
||||||
}
|
}
|
||||||
@@ -477,7 +516,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
aTab._endRemoveArgs = [closeWindow, newTab];
|
aTab._endRemoveArgs = [closeWindow, newTab];
|
||||||
|
|
||||||
// swapBrowsersAndCloseOther will take care of closing the window without animation.
|
// swapBrowsersAndCloseOther will take care of closing the window without animation.
|
||||||
@@ -4645,9 +4783,7 @@
|
@@ -4645,9 +4790,7 @@
|
||||||
aTab._mouseleave();
|
aTab._mouseleave();
|
||||||
|
|
||||||
if (newTab) {
|
if (newTab) {
|
||||||
@@ -488,7 +527,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
} else {
|
} else {
|
||||||
TabBarVisibility.update();
|
TabBarVisibility.update();
|
||||||
}
|
}
|
||||||
@@ -4776,6 +4912,8 @@
|
@@ -4776,6 +4919,8 @@
|
||||||
this.tabs[i]._tPos = i;
|
this.tabs[i]._tPos = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +536,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
if (!this._windowIsClosing) {
|
if (!this._windowIsClosing) {
|
||||||
if (wasPinned) {
|
if (wasPinned) {
|
||||||
this.tabContainer._positionPinnedTabs();
|
this.tabContainer._positionPinnedTabs();
|
||||||
@@ -4994,7 +5132,7 @@
|
@@ -4994,7 +5139,7 @@
|
||||||
!excludeTabs.has(aTab.owner) &&
|
!excludeTabs.has(aTab.owner) &&
|
||||||
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
|
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
|
||||||
) {
|
) {
|
||||||
@@ -506,7 +545,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to find a remaining tab that comes after the given tab
|
// Try to find a remaining tab that comes after the given tab
|
||||||
@@ -5016,7 +5154,7 @@
|
@@ -5016,7 +5161,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tab) {
|
if (tab) {
|
||||||
@@ -515,7 +554,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If no qualifying visible tab was found, see if there is a tab in
|
// If no qualifying visible tab was found, see if there is a tab in
|
||||||
@@ -5434,10 +5572,10 @@
|
@@ -5434,10 +5579,10 @@
|
||||||
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,7 +567,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
aTab.selected ||
|
aTab.selected ||
|
||||||
aTab.closing ||
|
aTab.closing ||
|
||||||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
|
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
|
||||||
@@ -5675,7 +5813,7 @@
|
@@ -5675,7 +5820,7 @@
|
||||||
|
|
||||||
// Don't allow mixing pinned and unpinned tabs.
|
// Don't allow mixing pinned and unpinned tabs.
|
||||||
if (aTab.pinned) {
|
if (aTab.pinned) {
|
||||||
@@ -537,7 +576,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
} else {
|
} else {
|
||||||
aIndex = Math.max(aIndex, this.pinnedTabCount);
|
aIndex = Math.max(aIndex, this.pinnedTabCount);
|
||||||
}
|
}
|
||||||
@@ -5685,10 +5823,17 @@
|
@@ -5685,10 +5830,17 @@
|
||||||
|
|
||||||
this._handleTabMove(aTab, () => {
|
this._handleTabMove(aTab, () => {
|
||||||
let neighbor = this.tabs[aIndex];
|
let neighbor = this.tabs[aIndex];
|
||||||
@@ -557,7 +596,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
neighbor.after(aTab);
|
neighbor.after(aTab);
|
||||||
} else {
|
} else {
|
||||||
this.tabContainer.insertBefore(aTab, neighbor);
|
this.tabContainer.insertBefore(aTab, neighbor);
|
||||||
@@ -5697,7 +5842,7 @@
|
@@ -5697,7 +5849,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
moveTabToGroup(aTab, aGroup) {
|
moveTabToGroup(aTab, aGroup) {
|
||||||
@@ -566,7 +605,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (aTab.group && aTab.group.id === aGroup.id) {
|
if (aTab.group && aTab.group.id === aGroup.id) {
|
||||||
@@ -5721,6 +5866,10 @@
|
@@ -5721,6 +5873,10 @@
|
||||||
|
|
||||||
moveActionCallback();
|
moveActionCallback();
|
||||||
|
|
||||||
@@ -577,7 +616,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
// Clear tabs cache after moving nodes because the order of tabs may have
|
// Clear tabs cache after moving nodes because the order of tabs may have
|
||||||
// changed.
|
// changed.
|
||||||
this.tabContainer._invalidateCachedTabs();
|
this.tabContainer._invalidateCachedTabs();
|
||||||
@@ -5771,7 +5920,7 @@
|
@@ -5771,7 +5927,7 @@
|
||||||
createLazyBrowser,
|
createLazyBrowser,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -586,7 +625,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
|
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
|
||||||
params.pinned = true;
|
params.pinned = true;
|
||||||
}
|
}
|
||||||
@@ -6513,7 +6662,7 @@
|
@@ -6513,7 +6669,7 @@
|
||||||
// preventDefault(). It will still raise the window if appropriate.
|
// preventDefault(). It will still raise the window if appropriate.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -595,7 +634,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
window.focus();
|
window.focus();
|
||||||
aEvent.preventDefault();
|
aEvent.preventDefault();
|
||||||
break;
|
break;
|
||||||
@@ -7415,6 +7564,7 @@
|
@@ -7415,6 +7571,7 @@
|
||||||
aWebProgress.isTopLevel
|
aWebProgress.isTopLevel
|
||||||
) {
|
) {
|
||||||
this.mTab.setAttribute("busy", "true");
|
this.mTab.setAttribute("busy", "true");
|
||||||
@@ -603,7 +642,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||||
}
|
}
|
||||||
@@ -8381,7 +8531,7 @@ var TabContextMenu = {
|
@@ -8381,7 +8538,7 @@ var TabContextMenu = {
|
||||||
);
|
);
|
||||||
contextUnpinSelectedTabs.hidden =
|
contextUnpinSelectedTabs.hidden =
|
||||||
!this.contextTab.pinned || !multiselectionContext;
|
!this.contextTab.pinned || !multiselectionContext;
|
||||||
@@ -612,7 +651,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
// Move Tab items
|
// Move Tab items
|
||||||
let contextMoveTabOptions = document.getElementById(
|
let contextMoveTabOptions = document.getElementById(
|
||||||
"context_moveTabOptions"
|
"context_moveTabOptions"
|
||||||
@@ -8414,7 +8564,7 @@ var TabContextMenu = {
|
@@ -8414,7 +8571,7 @@ var TabContextMenu = {
|
||||||
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
||||||
let isFirstTab =
|
let isFirstTab =
|
||||||
tabsToMove[0] == visibleTabs[0] ||
|
tabsToMove[0] == visibleTabs[0] ||
|
||||||
@@ -621,7 +660,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..06a4aae50ebe8a42d08d4689d8e80a63
|
|||||||
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
||||||
|
|
||||||
document.getElementById("context_openTabInWindow").disabled =
|
document.getElementById("context_openTabInWindow").disabled =
|
||||||
@@ -8647,6 +8797,7 @@ var TabContextMenu = {
|
@@ -8647,6 +8804,7 @@ var TabContextMenu = {
|
||||||
if (this.contextTab.multiselected) {
|
if (this.contextTab.multiselected) {
|
||||||
gBrowser.removeMultiSelectedTabs();
|
gBrowser.removeMultiSelectedTabs();
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
|
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
|
||||||
index fa96568d366fd3608f9bd583fa793150bd815c8b..1c940a3b162919256ca73fa867c5c261a3395e25 100644
|
index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d734668f2a 100644
|
||||||
--- a/browser/components/tabbrowser/content/tabs.js
|
--- a/browser/components/tabbrowser/content/tabs.js
|
||||||
+++ b/browser/components/tabbrowser/content/tabs.js
|
+++ b/browser/components/tabbrowser/content/tabs.js
|
||||||
@@ -94,7 +94,7 @@
|
@@ -94,7 +94,7 @@
|
||||||
@@ -145,7 +145,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..1c940a3b162919256ca73fa867c5c261
|
|||||||
}
|
}
|
||||||
|
|
||||||
get verticalMode() {
|
get verticalMode() {
|
||||||
@@ -1537,28 +1565,40 @@
|
@@ -1537,29 +1565,41 @@
|
||||||
if (this.#allTabs) {
|
if (this.#allTabs) {
|
||||||
return this.#allTabs;
|
return this.#allTabs;
|
||||||
}
|
}
|
||||||
@@ -189,11 +189,12 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..1c940a3b162919256ca73fa867c5c261
|
|||||||
}
|
}
|
||||||
|
|
||||||
get allGroups() {
|
get allGroups() {
|
||||||
- let children = Array.from(this.arrowScrollbox.children);
|
let children = Array.from(this.arrowScrollbox.children);
|
||||||
+ let children = ZenWorkspaces.tabboxChildren;
|
- return children.filter(node => node.tagName == "tab-group");
|
||||||
return children.filter(node => node.tagName == "tab-group");
|
+ return ZenWorkspaces.allTabGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
@@ -1579,7 +1619,7 @@
|
@@ -1579,7 +1619,7 @@
|
||||||
*/
|
*/
|
||||||
get visibleTabs() {
|
get visibleTabs() {
|
||||||
|
12
src/toolkit/content/widgets/findbar-js.patch
Normal file
12
src/toolkit/content/widgets/findbar-js.patch
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
diff --git a/toolkit/content/widgets/findbar.js b/toolkit/content/widgets/findbar.js
|
||||||
|
index 8ca512e0b212bb6e25ed37e7edb4f8e2587d5bb0..5abfff92b3a8df5d138082af96419668a2c8a9bb 100644
|
||||||
|
--- a/toolkit/content/widgets/findbar.js
|
||||||
|
+++ b/toolkit/content/widgets/findbar.js
|
||||||
|
@@ -1188,6 +1188,7 @@
|
||||||
|
* e.g. <command name="cmd_find" oncommand="gFindBar.onFindCommand();"/>
|
||||||
|
*/
|
||||||
|
onFindCommand() {
|
||||||
|
+ if (gBrowser?.selectedTab?.hasAttribute("zen-empty-tab")) return;
|
||||||
|
return this.startFind(this.FIND_NORMAL);
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user