Merge branch 'dev' into glance-buttons-overflow

This commit is contained in:
Vrezh Fedora
2025-03-01 20:47:06 +01:00
21 changed files with 1326 additions and 172 deletions

View File

@@ -120,6 +120,7 @@ pref('zen.view.compact.show-sidebar-and-toolbar-on-hover', true);
pref('zen.urlbar.replace-newtab', true);
pref('zen.urlbar.behavior', 'floating-on-type'); // default, floating-on-type, float
pref('zen.urlbar.wait-to-clear', 45000); // in ms (default 45s)
pref('zen.urlbar.show-domain-only-in-sidebar', true);
#ifdef XP_MACOSX
// Disable for macos in the meantime until @HarryHeres finds a solution for hight DPI screens
@@ -370,6 +371,14 @@ pref('browser.download.autohideButton', false);
// Enable transparent background for macos
#ifdef XP_MACOSX
pref('widget.macos.titlebar-blend-mode.behind-window', true);
// 1. hudWindow
// 2. fullScreenUI
// 3. popover
// 4. menu
// 5. toolTip
// 6. headerView
// 7. underlay
pref('zen.widget.macos.window-material', 7);
#endif
// Urlbar and autocomplete

View File

@@ -41,7 +41,9 @@
} catch (e) {
console.error('ZenThemeModifier: Error initializing browser layout', e);
}
this.closeWatermark();
ZenWorkspaces.promiseInitialized.then(() => {
this.closeWatermark();
});
},
openWatermark() {

View File

@@ -9,6 +9,7 @@ var gZenUIManager = {
XPCOMUtils.defineLazyPreferenceGetter(this, 'sidebarHeightThrottle', 'zen.view.sidebar-height-throttle', 500);
XPCOMUtils.defineLazyPreferenceGetter(this, 'contentElementSeparation', 'zen.theme.content-element-separation', 0);
XPCOMUtils.defineLazyPreferenceGetter(this, 'urlbarWaitToClear', 'zen.urlbar.wait-to-clear', 0);
XPCOMUtils.defineLazyPreferenceGetter(this, 'urlbarShowDomainOnly', 'zen.urlbar.show-domain-only-in-sidebar', true);
gURLBar._zenTrimURL = this.urlbarTrim.bind(this);
@@ -218,7 +219,7 @@ var gZenUIManager = {
},
urlbarTrim(aURL) {
if (gZenVerticalTabsManager._hasSetSingleToolbar) {
if (gZenVerticalTabsManager._hasSetSingleToolbar && this.urlbarShowDomainOnly) {
let url = BrowserUIUtils.removeSingleTrailingSlashFromURL(aURL);
return url.startsWith('https://') ? url.split('/')[2] : url;
}

View File

@@ -34,6 +34,7 @@
margin-left: 0 !important;
position: absolute !important;
overflow: hidden;
transition: inset 0.1s;
}
#tabbrowser-tabpanels[zen-split-view='true']:not([zen-split-resizing]) > [zen-split-anim='true'] {
@@ -221,15 +222,6 @@
background-color: var(--zen-colors-secondary);
align-items: center;
z-index: 100;
}
.zen-view-splitter-drag-handle {
flex-grow: 1;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
cursor: move;
}
@@ -245,6 +237,7 @@
height: 24px;
cursor: pointer;
appearance: none;
margin-left: auto;
outline: var(--toolbarbutton-outline);
list-style-image: url('chrome://global/skin/icons/close-fill.svg') !important;
&:hover {

View File

@@ -1,29 +1,70 @@
tab-group[split-view-group] {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(calc(var(--tab-pinned-min-width-expanded) + 20px), auto));
gap: 1px;
display: flex;
flex-wrap: nowrap;
border-radius: var(--border-radius-medium);
padding: 0;
padding: 0 2px;
margin-inline: var(--tab-block-margin);
margin-block: var(--tab-block-margin);
min-height: var(--tab-min-height);
outline: var(--tab-outline);
outline-offset: var(--tab-outline-offset);
outline-color: var(--tab-selected-outline-color);
padding: 1px;
transition: scale 0.1s ease;
align-items: center;
--zen-split-view-active-tab-bg: color-mix(in srgb, var(--zen-toolbar-element-bg), transparent 40%);
& > * {
--tab-min-height: 32px;
--tab-selected-bgcolor: var(--zen-toolbar-element-bg);
--tab-selected-shadow: none;
--border-radius-medium: calc(2px + var(--tab-border-radius));
--zen-active-tab-scale: 1;
:root:not([zen-sidebar-expanded='true']) & {
padding: 2px 0;
}
&:has(tab[visuallyselected]) {
& > .tabbrowser-tab {
--tab-selected-bgcolor: var(--zen-split-view-active-tab-bg);
--tab-hover-background-color: transparent;
--tab-selected-shadow: none;
--border-radius-medium: var(--tab-border-radius);
--zen-active-tab-scale: 1;
:root[zen-sidebar-expanded='true'] & {
--tab-min-height: 28px;
}
flex: 1 !important;
&:not(:last-child)::after {
content: '';
width: 1px;
height: 16px;
background-color: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.2));
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
}
:root:not([zen-sidebar-expanded='true']) &:not(:last-child)::after {
width: 16px;
height: 1px;
top: auto;
bottom: 0;
right: 50%;
transform: translateX(50%);
}
}
&:has(> tab[visuallyselected]) {
background-color: var(--tab-selected-bgcolor);
box-shadow: var(--tab-selected-shadow);
& > .tabbrowser-tab {
--tab-hover-background-color: var(--zen-split-view-active-tab-bg);
& .tab-background {
background-color: var(--zen-split-view-active-tab-bg) !important;
}
&::after {
display: none;
}
}
}
&:active {
@@ -37,6 +78,18 @@ tab-group[split-view-group] {
& .tab-close-button {
display: none !important;
}
@media (prefers-reduced-motion: no-preference) {
#tabbrowser-tabs[movingtab] & {
transition: var(--tab-dragover-transition);
}
}
}
:root:not([zen-sidebar-expanded='true']) {
tab-group {
flex-direction: column;
}
}
tab-group[split-view-group] .tabbrowser-tab {

View File

@@ -391,7 +391,7 @@
max-height: unset !important;
& .tabbrowser-tab:not(:hover) .tab-background:not([selected]):not([multiselected]) {
background: transparent !important;
background: transparent;
}
& .tabbrowser-tab .tab-content {
@@ -872,7 +872,7 @@
display: block;
width: 2.5px;
height: 16px;
background: light-dark(rgba(88, 79, 79, 0.02), rgba(255, 255, 255, 0.3));
background: light-dark(rgba(66, 61, 61, 0.3), rgba(255, 255, 255, 0.3));
position: absolute;
right: 0;
top: 50%;

View File

@@ -104,7 +104,7 @@
--zen-button-border-radius: 5px;
--zen-button-padding: 0.6rem 1.2rem;
--zen-toolbar-element-bg: light-dark(rgba(89, 89, 89, 0.1), rgba(255, 255, 255, 0.125));
--zen-toolbar-element-bg: light-dark(rgba(89, 89, 89, 0.1), rgba(255, 255, 255, 0.1));
/* Toolbar */
--zen-toolbar-height: 38px;

View File

@@ -190,14 +190,16 @@ var gZenCompactModeManager = {
}
)
.then(() => {
this.sidebar.removeAttribute('animate');
this.sidebar.style.removeProperty('margin-right');
this.sidebar.style.removeProperty('margin-left');
this.sidebar.style.removeProperty('transform');
this.sidebar.style.transition = 'none';
setTimeout(() => {
this._animating = false;
this.sidebar.style.removeProperty('transition');
window.requestAnimationFrame(() => {
this.sidebar.removeAttribute('animate');
this.sidebar.style.removeProperty('margin-right');
this.sidebar.style.removeProperty('margin-left');
this.sidebar.style.removeProperty('transform');
this.sidebar.style.transition = 'none';
setTimeout(() => {
this._animating = false;
this.sidebar.style.removeProperty('transition');
});
});
});
} else if (canHideSidebar && !isCompactMode) {

View File

@@ -1,4 +1,3 @@
{
class ZenFolders {
constructor() {
@@ -17,10 +16,46 @@
group.pinned = tab.pinned;
}
#onTabUngrouped(event) {
#onTabUngrouped(event) {}
#onTabGroupRemoved(event) {}
expandGroupTabs(group) {
for (const tab of group.tabs) {
gBrowser.ungroupTab(tab);
}
}
#onTabGroupRemoved(event) {
handleTabPin(tab) {
const group = tab.group;
if (!group) {
return false;
}
if (group.hasAttribute('split-view-group')) {
for (const tab of group.tabs) {
tab.setAttribute('pinned', 'true');
}
gBrowser.verticalPinnedTabsContainer.insertBefore(group, gBrowser.verticalPinnedTabsContainer.lastChild);
gBrowser.tabContainer._invalidateCachedTabs();
return true;
}
return false;
}
handleTabUnpin(tab) {
const group = tab.group;
if (!group) {
return false;
}
if (group.hasAttribute('split-view-group')) {
for (const tab of group.tabs) {
tab.removeAttribute('pinned');
}
ZenWorkspaces.activeWorkspaceStrip.prepend(group);
gBrowser.tabContainer._invalidateCachedTabs();
return true;
}
return false;
}
}

View File

@@ -882,8 +882,14 @@
return forToolbar ? 'var(--zen-themed-toolbar-bg)' : 'var(--zen-themed-toolbar-bg-transparent)';
} else if (themedColors.length === 1) {
return this.getSingleRGBColor(themedColors[0], forToolbar);
} else if (themedColors.length !== 3) {
return `linear-gradient(${this.currentRotation}deg, ${themedColors.map((color) => this.getSingleRGBColor(color, forToolbar)).join(', ')})`;
} else {
let color1 = this.getSingleRGBColor(themedColors[2], forToolbar);
let color2 = this.getSingleRGBColor(themedColors[0], forToolbar);
let color3 = this.getSingleRGBColor(themedColors[1], forToolbar);
return `linear-gradient(${this.currentRotation}deg, ${color1}, ${color2}, ${color3})`;
}
return `linear-gradient(${this.currentRotation}deg, ${themedColors.map((color) => this.getSingleRGBColor(color, forToolbar)).join(', ')})`;
}
static getTheme(colors = [], opacity = 0.5, rotation = -45, texture = 0) {

View File

@@ -288,6 +288,8 @@
if (container) {
container.insertBefore(newTab, container.lastChild);
}
} else {
document.getElementById('zen-essentials-container').prepend(newTab);
}
gBrowser.tabContainer._invalidateCachedTabs();
newTab.initialize();

View File

@@ -69,6 +69,8 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
_edgeHoverSize;
minResizeWidth;
MAX_TABS = 4;
init() {
XPCOMUtils.defineLazyPreferenceGetter(this, 'canChangeTabOnHover', 'zen.splitView.change-on-hover', false);
XPCOMUtils.defineLazyPreferenceGetter(this, 'minResizeWidth', 'zen.splitView.min-resize-width', 7);
@@ -565,6 +567,8 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
* @param {number} groupIndex - The index of the group to remove.
*/
removeGroup(groupIndex) {
const group = this._data[groupIndex];
gZenFolders.expandGroupTabs(group);
if (this.currentView === groupIndex) {
this.deactivateCurrentSplitView();
}
@@ -671,7 +675,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
* @returns {boolean} True if the tabs can be split, false otherwise.
*/
contextCanSplitTabs() {
if (window.gBrowser.selectedTabs.length < 2) {
if (window.gBrowser.selectedTabs.length < 2 || window.gBrowser.selectedTabs.length > this.MAX_TABS) {
return false;
}
for (const tab of window.gBrowser.selectedTabs) {
@@ -704,7 +708,9 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
* @param {string} gridType - The type of grid layout.
*/
splitTabs(tabs, gridType) {
if (tabs.length < 2) {
const firstisPinned = tabs[0].pinned;
tabs = tabs.filter((t) => t.pinned === firstisPinned && !t.hidden && !t.hasAttribute('zen-empty-tab'));
if (tabs.length < 2 || tabs.length > this.MAX_TABS) {
return;
}
@@ -720,9 +726,10 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
group.layoutTree = this.calculateLayoutTree([...new Set(group.tabs.concat(tabs))], gridType);
} else {
// Add any tabs that are not already in the group
for (const tab of tabs) {
if (!group.tabs.includes(tab)) {
group.tabs.push(tab);
for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i];
if (!group.tabs.includes(tab) && tab.pinned === !!group.pinned) {
gBrowser.moveTabToGroup(tab, this._getSplitViewGroup(tabs));
this.addTabToSplit(tab, group.layoutTree);
}
}
@@ -872,9 +879,6 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
_createHeader(container) {
const header = document.createElement('div');
header.classList.add('zen-view-splitter-header');
const dragHandle = document.createElement('div');
dragHandle.classList.add('zen-view-splitter-drag-handle');
header.appendChild(dragHandle);
const removeButton = document.createXULElement('toolbarbutton');
removeButton.classList.add('zen-tab-unsplit-button');
removeButton.addEventListener('click', () => {
@@ -1301,7 +1305,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
const groupIndex = this._data.findIndex((group) => group.tabs.includes(droppedOnTab));
const group = this._data[groupIndex];
if (!group.tabs.includes(draggedTab)) {
if (!group.tabs.includes(draggedTab) && group.tabs.length < this.MAX_TABS) {
// First move the tab to the split view group
let splitGroup = droppedOnTab.group;
if (splitGroup && (!draggedTab.group || draggedTab.group !== splitGroup)) {
@@ -1378,9 +1382,9 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
const group = gBrowser.addTabGroup(tabs, {
label: '',
showCreateUI: false,
insertBefore: tabs[0],
forSplitView: true,
});
group.setAttribute('split-view-group', true);
}
return null;

View File

@@ -32,6 +32,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this._resolveSectionsInitialized = resolve;
});
promiseInitialized = new Promise((resolve) => {
this._resolveInitialized = resolve;
});
workspaceIndicatorXUL = `
<hbox class="zen-current-workspace-indicator-icon"></hbox>
<hbox class="zen-current-workspace-indicator-name"></hbox>
@@ -43,6 +47,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
async init() {
if (!this.shouldHaveWorkspaces) {
this._resolveInitialized();
document.getElementById('zen-current-workspace-indicator-container').setAttribute('hidden', 'true');
console.warn('ZenWorkspaces: !!! ZenWorkspaces is disabled in hidden windows !!!');
return; // We are in a hidden window, don't initialize ZenWorkspaces
@@ -139,9 +144,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
_initializeEmptyTab() {
gBrowser._forZenEmptyTab = true;
this._emptyTab = gBrowser.addTrustedTab('about:blank', { inBackground: true, userContextId: 0 });
this._emptyTab.setAttribute('zen-empty-tab', 'true');
this._emptyTab = gBrowser.addTrustedTab('about:blank', { inBackground: true, userContextId: 0, _forZenEmptyTab: true });
}
registerPinnedResizeObserver() {
@@ -260,6 +263,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
_organizeTabsToWorkspaceSections(workspace, section, pinnedSection, tabs) {
const workspaceTabs = Array.from(tabs).filter((tab) => tab.getAttribute('zen-workspace-id') === workspace.uuid);
let firstNormalTab = null;
for (const tab of workspaceTabs) {
if (tab.hasAttribute('zen-essential')) {
continue; // Ignore essentials as they need to be in their own section
@@ -269,9 +273,18 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
if (tab.pinned) {
pinnedSection.insertBefore(tab, pinnedSection.nextSibling);
} else {
if (!firstNormalTab) {
firstNormalTab = tab;
}
section.insertBefore(tab, section.lastChild);
}
}
// Kind of a hacky fix, but for some reason the first normal tab in the list
// created by session restore is added the the last position of the tab list
// let's just prepend it to the section
if (firstNormalTab) {
section.insertBefore(firstNormalTab, section.firstChild);
}
}
initializeWorkspaceNavigation() {
@@ -512,9 +525,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
if (typeof this._workspaceEnabled === 'undefined') {
this._workspaceEnabled =
!Services.prefs.getBoolPref('zen.workspaces.disabled_for_testing', false) && this.shouldHaveWorkspaces;
return this._workspaceEnabled;
}
return this._workspaceEnabled;
return this._workspaceEnabled && !window.closed;
}
getActiveWorkspaceFromCache() {
@@ -591,6 +603,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
console.error('ZenWorkspaces: Error initializing theme picker', e);
}
this._selectStartPage();
this._fixTabPositions();
this._resolveInitialized();
}
}
@@ -985,21 +999,15 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}.bind(browser.ZenWorkspaces)
);
element.addEventListener(
'dragenter',
function (event) {
if (this.isReorderModeOn(browser) && this.draggedElement) {
element.classList.add('dragover');
}
}.bind(browser.ZenWorkspaces)
);
element.addEventListener('dragenter', function (event) {
if (this.isReorderModeOn(browser) && this.draggedElement) {
element.classList.add('dragover');
}
});
element.addEventListener(
'dragleave',
function (event) {
element.classList.remove('dragover');
}.bind(browser.ZenWorkspaces)
);
element.addEventListener('dragleave', function (event) {
element.classList.remove('dragover');
});
element.addEventListener(
'drop',
@@ -1538,10 +1546,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
_moveEmptyTabToWorkspace(workspaceUuid) {
const emptyTab = this._emptyTab;
if (emptyTab) {
this.moveTabToWorkspace(emptyTab, workspaceUuid);
}
this._makeSureEmptyTabIsLast();
}
_makeSureEmptyTabIsLast() {
@@ -1552,6 +1557,15 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
container.insertBefore(emptyTab, container.lastChild);
}
}
this._fixTabPositions();
}
_fixTabPositions() {
// Fix tabs _tPos values relative to the actual order
const tabs = gBrowser.tabs;
for (let i = 0; i < tabs.length; i++) {
tabs[i]._tPos = i;
}
}
_updateMarginTopPinnedTabs(arrowscrollbox, pinnedContainer) {

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e839577cdb 100644
index 628aa6596627c85efe361fc1ece8fd58f7ee653e..f4a4ad413785e08bbb70df8cbb5feefd71c4dfe1 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -412,11 +412,50 @@
@@ -55,25 +55,42 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
}
return i;
}
@@ -814,7 +853,7 @@
this.ungroupTab(aTab);
if (this.tabContainer.verticalMode) {
@@ -811,12 +850,13 @@
}
this.showTab(aTab);
- this.ungroupTab(aTab);
- if (this.tabContainer.verticalMode) {
+ const handled = gZenFolders.handleTabPin(aTab);
+ if (!handled) this.ungroupTab(aTab);
+ if (this.tabContainer.verticalMode && !handled) {
this._handleTabMove(aTab, () =>
- this.verticalPinnedTabsContainer.appendChild(aTab)
+ aTab.hasAttribute("zen-essential") ? document.getElementById("zen-essentials-container").appendChild(aTab) : this.verticalPinnedTabsContainer.insertBefore(aTab, this.verticalPinnedTabsContainer.lastChild)
);
} else {
- } else {
+ } else if (!handled) {
this.moveTabTo(aTab, this.pinnedTabCount, { forceStandaloneTab: true });
@@ -835,7 +874,7 @@
}
aTab.setAttribute("pinned", "true");
@@ -830,12 +870,15 @@
}
if (this.tabContainer.verticalMode) {
+ const handled = gZenFolders.handleTabUnpin(aTab);
this._handleTabMove(aTab, () => {
// we remove this attribute first, so that allTabs represents
// the moving of a tab from the vertical pinned tabs container
// and back into arrowscrollbox.
aTab.removeAttribute("pinned");
- this.tabContainer.arrowScrollbox.prepend(aTab);
+ ZenWorkspaces.activeWorkspaceStrip.prepend(aTab);
+ if (!handled) {
+ ZenWorkspaces.activeWorkspaceStrip.prepend(aTab);
+ }
});
} else {
this.moveTabTo(aTab, this.pinnedTabCount - 1, {
@@ -1018,6 +1057,8 @@
@@ -1018,6 +1061,8 @@
let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"];
@@ -82,7 +99,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (
aIconURL &&
!aLoadingPrincipal &&
@@ -1028,6 +1069,9 @@
@@ -1028,6 +1073,9 @@
);
return;
}
@@ -92,7 +109,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
let browser = this.getBrowserForTab(aTab);
browser.mIconURL = aIconURL;
@@ -1273,6 +1317,7 @@
@@ -1273,6 +1321,7 @@
if (!this._previewMode) {
newTab.recordTimeFromUnloadToReload();
newTab.updateLastAccessed();
@@ -100,7 +117,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
oldTab.updateLastAccessed();
// if this is the foreground window, update the last-seen timestamps.
if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) {
@@ -1425,6 +1470,9 @@
@@ -1425,6 +1474,9 @@
}
let activeEl = document.activeElement;
@@ -110,7 +127,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
// If focus is on the old tab, move it to the new tab.
if (activeEl == oldTab) {
newTab.focus();
@@ -1748,7 +1796,7 @@
@@ -1748,7 +1800,7 @@
}
_setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle, isURL } = {}) {
@@ -119,7 +136,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
return false;
}
@@ -1851,7 +1899,7 @@
@@ -1851,7 +1903,7 @@
newIndex = this.selectedTab._tPos + 1;
}
@@ -128,17 +145,25 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
let browser;
if (targetTab) {
browser = this.getBrowserForTab(targetTab);
@@ -2182,7 +2230,8 @@
@@ -2108,6 +2160,7 @@
uriIsAboutBlank,
userContextId,
skipLoad,
+ _forZenEmptyTab,
} = {}) {
let b = document.createXULElement("browser");
// Use the JSM global to create the permanentKey, so that if the
@@ -2181,8 +2234,7 @@
// we use a different attribute name for this?
b.setAttribute("name", name);
}
-
- if (this._allowTransparentBrowser) {
+ if (this._allowTransparentBrowser || this._forZenEmptyTab) {
+ delete this._forZenEmptyTab;
+ if (this._allowTransparentBrowser || _forZenEmptyTab) {
b.setAttribute("transparent", "true");
}
@@ -2347,7 +2396,7 @@
@@ -2347,7 +2399,7 @@
let panel = this.getPanel(browser);
let uniqueId = this._generateUniquePanelID();
@@ -147,7 +172,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
aTab.linkedPanel = uniqueId;
// Inject the <browser> into the DOM if necessary.
@@ -2406,8 +2455,8 @@
@@ -2406,8 +2458,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) {
@@ -158,7 +183,15 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
} else {
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
}
@@ -2639,6 +2688,12 @@
@@ -2629,6 +2681,7 @@
schemelessInput,
hasValidUserGestureActivation = false,
textDirectiveUserActivation = false,
+ _forZenEmptyTab,
} = {}
) {
// all callers of addTab that pass a params object need to pass
@@ -2639,6 +2692,12 @@
);
}
@@ -171,7 +204,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (!UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.start("browser.tabs.opening", "initting", window);
}
@@ -2702,6 +2757,12 @@
@@ -2702,6 +2761,15 @@
noInitialLabel,
skipBackgroundNotify,
});
@@ -180,11 +213,22 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
+ }
+ if (zenForcedWorkspaceId !== undefined) {
+ t.setAttribute("zen-workspace-id", zenForcedWorkspaceId);
+ }
+ if (_forZenEmptyTab) {
+ t.setAttribute("zen-empty-tab", "true");
+ }
if (insertTab) {
// insert the tab into the tab container in the correct position
this._insertTabAtIndex(t, {
@@ -2845,6 +2906,9 @@
@@ -2726,6 +2794,7 @@
initialBrowsingContextGroupId,
openWindowInfo,
skipLoad,
+ _forZenEmptyTab,
}));
if (focusUrlBar) {
@@ -2845,6 +2914,9 @@
}
}
@@ -194,17 +238,44 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
// Additionally send pinned tab events
if (pinned) {
this._notifyPinnedStatus(t);
@@ -2918,7 +2982,8 @@
@@ -2904,6 +2976,7 @@
label = "",
insertBefore = null,
showCreateUI = false,
+ forSplitView = false,
} = {}
) {
if (!tabs?.length) {
@@ -2918,7 +2991,11 @@
id = `${Date.now()}-${Math.round(Math.random() * 100)}`;
}
let group = this._createTabGroup(id, color, false, label);
- this.tabContainer.insertBefore(
+ if (forSplitView) {
+ group.setAttribute('split-view-group', true);
+ }
+ group.pinned = tabs.some(tab => tab.pinned);
+ (group.pinned ? this.verticalPinnedTabsContainer : this.tabContainer).insertBefore(
group,
insertBefore?.group ?? insertBefore
);
@@ -3367,6 +3432,24 @@
@@ -3126,6 +3203,7 @@
initialBrowsingContextGroupId,
openWindowInfo,
skipLoad,
+ _forZenEmptyTab
}
) {
// If we don't have a preferred remote type, and we have a remote
@@ -3189,6 +3267,7 @@
openWindowInfo,
name,
skipLoad,
+ _forZenEmptyTab
});
}
@@ -3367,6 +3446,24 @@
) {
tabWasReused = true;
tab = this.selectedTab;
@@ -229,7 +300,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (!tabData.pinned) {
this.unpinTab(tab);
} else {
@@ -3380,6 +3463,7 @@
@@ -3380,6 +3477,7 @@
restoreTabsLazily && !select && !tabData.pinned;
let url = "about:blank";
@@ -237,7 +308,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (tabData.entries?.length) {
let activeIndex = (tabData.index || tabData.entries.length) - 1;
// Ensure the index is in bounds.
@@ -3415,7 +3499,24 @@
@@ -3415,7 +3513,24 @@
skipLoad: true,
preferredRemoteType,
});
@@ -263,7 +334,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (select) {
tabToSelect = tab;
}
@@ -3428,8 +3529,8 @@
@@ -3428,8 +3543,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) {
@@ -274,7 +345,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
tab.toggleAttribute("pinned", true);
this.tabContainer._invalidateCachedTabs();
// Then ensure all the tab open/pinning information is sent.
@@ -3693,7 +3794,7 @@
@@ -3693,7 +3808,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.
@@ -283,7 +354,17 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (
!bulkOrderedOpen &&
((openerTab &&
@@ -3744,7 +3845,7 @@
@@ -3736,18 +3851,18 @@
// Ensure index is within bounds.
if (tab.pinned) {
- index = Math.max(index, 0);
- index = Math.min(index, this.pinnedTabCount);
+ index = Math.max(index, tab.hasAttribute("zen-essential") ? 0 : this._numZenEssentials);
+ index = Math.min(index, tab.hasAttribute("zen-essential") ? this._numZenEssentials : this.pinnedTabCount);
} else {
index = Math.max(index, this.pinnedTabCount);
index = Math.min(index, this.tabs.length);
}
/** @type {MozTabbrowserTab|undefined} */
@@ -291,8 +372,12 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
+ let tabAfter = this.tabs.filter(tab => !tab.hasAttribute("zen-glance-tab")).at(index);
this.tabContainer._invalidateCachedTabs();
if (tabGroup) {
@@ -4059,6 +4160,9 @@
- if (tabGroup) {
+ if (tabGroup && !tabGroup.hasAttribute("split-view-group")) {
if (tabAfter && tabAfter.group == tabGroup) {
// Place at the front of, or between tabs in, the same tab group
this.tabContainer.insertBefore(tab, tabAfter);
@@ -4059,6 +4174,9 @@
return;
}
@@ -302,7 +387,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
this.removeTabs(selectedTabs);
}
@@ -4391,6 +4495,7 @@
@@ -4391,6 +4509,7 @@
skipSessionStore,
} = {}
) {
@@ -310,7 +395,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.finish("browser.tabs.opening", window);
}
@@ -4407,6 +4512,12 @@
@@ -4407,6 +4526,12 @@
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
}
@@ -323,7 +408,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate && aTab.closing) {
@@ -4421,7 +4532,9 @@
@@ -4421,7 +4546,9 @@
// frame created for it (for example, by updating the visually selected
// state).
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
@@ -334,7 +419,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (
!this._beginRemoveTab(aTab, {
closeWindowFastpath: true,
@@ -4435,7 +4548,6 @@
@@ -4435,7 +4562,6 @@
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
return;
}
@@ -342,7 +427,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
let lockTabSizing =
!this.tabContainer.verticalMode &&
!aTab.pinned &&
@@ -4574,14 +4686,14 @@
@@ -4574,14 +4700,14 @@
!!this.tabsInCollapsedTabGroups.length;
if (
aTab.visible &&
@@ -359,7 +444,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
@@ -4605,6 +4717,7 @@
@@ -4605,6 +4731,7 @@
newTab = true;
}
@@ -367,7 +452,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
aTab._endRemoveArgs = [closeWindow, newTab];
// swapBrowsersAndCloseOther will take care of closing the window without animation.
@@ -4645,9 +4758,7 @@
@@ -4645,9 +4772,7 @@
aTab._mouseleave();
if (newTab) {
@@ -378,7 +463,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
} else {
TabBarVisibility.update();
}
@@ -4776,6 +4887,8 @@
@@ -4776,6 +4901,8 @@
this.tabs[i]._tPos = i;
}
@@ -387,7 +472,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (!this._windowIsClosing) {
if (wasPinned) {
this.tabContainer._positionPinnedTabs();
@@ -4994,7 +5107,7 @@
@@ -4994,7 +5121,7 @@
!excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
) {
@@ -396,7 +481,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
}
// Try to find a remaining tab that comes after the given tab
@@ -5016,7 +5129,7 @@
@@ -5016,7 +5143,7 @@
}
if (tab) {
@@ -405,7 +490,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
}
// If no qualifying visible tab was found, see if there is a tab in
@@ -5434,10 +5547,10 @@
@@ -5434,10 +5561,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
@@ -418,7 +503,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -5675,7 +5788,7 @@
@@ -5675,7 +5802,7 @@
// Don't allow mixing pinned and unpinned tabs.
if (aTab.pinned) {
@@ -427,18 +512,29 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
} else {
aIndex = Math.max(aIndex, this.pinnedTabCount);
}
@@ -5684,8 +5797,8 @@
@@ -5684,11 +5811,18 @@
}
this._handleTabMove(aTab, () => {
- let neighbor = this.tabs[aIndex];
- if (forceStandaloneTab && neighbor.group) {
+ let neighbor = this.tabs.filter(tab => !tab.hasAttribute("zen-glance-tab"))[aIndex];
+ if (forceStandaloneTab && neighbor.group || (neighbor.group && neighbor.group.hasAttribute("split-view-group"))) {
+ const _tPos = aTab._tPos;
+ if ((forceStandaloneTab && neighbor.group) || neighbor.group?.hasAttribute("split-view-group")) {
neighbor = neighbor.group;
}
if (neighbor && aIndex >= aTab._tPos) {
@@ -5697,7 +5810,7 @@
- if (neighbor && aIndex >= aTab._tPos) {
+ if (aTab.group?.hasAttribute("split-view-group")) {
+ aTab = aTab.group;
+ }
+ if (aTab.group?.hasAttribute("split-view-group") && neighbor == aTab.group) {
+ return;
+ }
+ if (neighbor && aIndex >= _tPos) {
neighbor.after(aTab);
} else {
this.tabContainer.insertBefore(aTab, neighbor);
@@ -5697,7 +5831,7 @@
}
moveTabToGroup(aTab, aGroup) {
@@ -447,7 +543,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
return;
}
if (aTab.group && aTab.group.id === aGroup.id) {
@@ -5721,6 +5834,8 @@
@@ -5721,6 +5855,8 @@
moveActionCallback();
@@ -456,7 +552,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
// Clear tabs cache after moving nodes because the order of tabs may have
// changed.
this.tabContainer._invalidateCachedTabs();
@@ -5771,7 +5886,7 @@
@@ -5771,7 +5907,7 @@
createLazyBrowser,
};
@@ -465,7 +561,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
params.pinned = true;
}
@@ -7415,6 +7530,7 @@
@@ -7415,6 +7551,7 @@
aWebProgress.isTopLevel
) {
this.mTab.setAttribute("busy", "true");
@@ -473,7 +569,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected;
}
@@ -8381,7 +8497,7 @@ var TabContextMenu = {
@@ -8381,7 +8518,7 @@ var TabContextMenu = {
);
contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !multiselectionContext;
@@ -482,7 +578,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
// Move Tab items
let contextMoveTabOptions = document.getElementById(
"context_moveTabOptions"
@@ -8414,7 +8530,7 @@ var TabContextMenu = {
@@ -8414,7 +8551,7 @@ var TabContextMenu = {
let contextMoveTabToStart = document.getElementById("context_moveToStart");
let isFirstTab =
tabsToMove[0] == visibleTabs[0] ||
@@ -491,7 +587,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..dc1bf702844ab60eb781c12dd59d29e8
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
document.getElementById("context_openTabInWindow").disabled =
@@ -8647,6 +8763,7 @@ var TabContextMenu = {
@@ -8647,6 +8784,7 @@ var TabContextMenu = {
if (this.contextTab.multiselected) {
gBrowser.removeMultiSelectedTabs();
} else {

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed42959e7331a1 100644
index fa96568d366fd3608f9bd583fa793150bd815c8b..9a288957781277246b66a911590a13e7231958d0 100644
--- a/browser/components/tabbrowser/content/tabs.js
+++ b/browser/components/tabbrowser/content/tabs.js
@@ -94,7 +94,7 @@
@@ -62,18 +62,23 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
if (draggedTab && dropEffect == "copy") {
// copy the dropped tab (wherever it's from)
let newIndex = this._getDropIndex(event);
@@ -1034,8 +1046,8 @@
@@ -1034,10 +1046,11 @@
}
} else {
let pinned = draggedTab.pinned;
- let numPinned = gBrowser.pinnedTabCount;
- let tabs = this.visibleTabs.slice(
- pinned ? 0 : numPinned,
- pinned ? numPinned : undefined
+ let numPinned = gBrowser._numVisiblePinTabs;
+ let essential = draggedTab.hasAttribute("zen-essential");
+ let tabs = this.visibleTabs.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(
pinned ? 0 : numPinned,
pinned ? numPinned : undefined
+ pinned ? (essential ? 0 : gBrowser._numZenVisibleEssentials) : numPinned,
+ pinned ? (essential ? gBrowser._numZenVisibleEssentials : numPinned) : undefined
);
@@ -1114,7 +1126,7 @@
let size = this.verticalMode ? "height" : "width";
let screenAxis = this.verticalMode ? "screenY" : "screenX";
@@ -1114,7 +1127,7 @@
let postTransitionCleanup = () => {
tab.removeAttribute("tabdrop-samewindow");
@@ -82,7 +87,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
if (dropIndex !== false) {
gBrowser.moveTabTo(tab, dropIndex);
if (!directionForward) {
@@ -1122,7 +1134,7 @@
@@ -1122,7 +1135,7 @@
}
}
};
@@ -91,7 +96,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
postTransitionCleanup();
} else {
let onTransitionEnd = transitionendEvent => {
@@ -1279,13 +1291,23 @@
@@ -1279,13 +1292,23 @@
return;
}
@@ -117,7 +122,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
) {
delete draggedTab._dragData;
return;
@@ -1517,7 +1539,7 @@
@@ -1517,7 +1540,7 @@
}
get newTabButton() {
@@ -126,7 +131,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
}
get verticalMode() {
@@ -1537,7 +1559,7 @@
@@ -1537,28 +1560,40 @@
if (this.#allTabs) {
return this.#allTabs;
}
@@ -135,8 +140,14 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
// remove arrowScrollbox periphery element
children.pop();
@@ -1551,14 +1573,29 @@
}
// explode tab groups
// Iterate backwards over the array to preserve indices while we modify
// things in place
- for (let i = children.length - 1; i >= 0; i--) {
- if (children[i].tagName == "tab-group") {
- children.splice(i, 1, ...children[i].tabs);
- }
- }
this.#allTabs = [
- ...this.verticalPinnedTabsContainer.children,
@@ -150,12 +161,14 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
+ if (glanceTab) {
+ // insert right after the parent tab. note: it must be inserted before
+ // the last pinned tab so it can be inserted in the correct order
+ this.#allTabs.splice(Math.min(i + 1, lastPinnedTabIdx), 0, glanceTab);
+ this.#allTabs.splice(Math.max(i + 1, lastPinnedTabIdx), 0, glanceTab);
+ i++;
+ } else if (this.#allTabs[i].classList.contains("vertical-pinned-tabs-container-separator")) {
+ // remove the separator from the list
+ this.#allTabs.splice(i, 1);
+ i--;
+ } else if (this.#allTabs[i].tagName == "tab-group") {
+ this.#allTabs.splice(i, 1, ...this.#allTabs[i].tabs);
+ }
+ }
return this.#allTabs;
@@ -167,7 +180,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
return children.filter(node => node.tagName == "tab-group");
}
@@ -1579,7 +1616,7 @@
@@ -1579,7 +1614,7 @@
*/
get visibleTabs() {
if (!this.#visibleTabs) {
@@ -176,7 +189,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
}
return this.#visibleTabs;
}
@@ -1613,10 +1650,8 @@
@@ -1613,10 +1648,8 @@
return this.#focusableItems;
}
@@ -189,7 +202,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
let focusableItems = [];
for (let child of children) {
@@ -1632,6 +1667,7 @@
@@ -1632,6 +1665,7 @@
}
this.#focusableItems = [
@@ -197,7 +210,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
...verticalPinnedTabsContainer.children,
...focusableItems,
];
@@ -1642,6 +1678,7 @@
@@ -1642,6 +1676,7 @@
_invalidateCachedTabs() {
this.#allTabs = null;
this._invalidateCachedVisibleTabs();
@@ -205,7 +218,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
}
_invalidateCachedVisibleTabs() {
@@ -1656,8 +1693,8 @@
@@ -1656,8 +1691,8 @@
#isContainerVerticalPinnedExpanded(tab) {
return (
this.verticalMode &&
@@ -216,7 +229,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
);
}
@@ -1672,7 +1709,7 @@
@@ -1672,7 +1707,7 @@
if (node == null) {
// We have a container for non-tab elements at the end of the scrollbox.
@@ -225,7 +238,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
}
node.before(tab);
@@ -1772,7 +1809,7 @@
@@ -1772,7 +1807,7 @@
// There are separate "new tab" buttons for horizontal tabs toolbar, vertical tabs and
// for when the tab strip is overflowed (which is shared by vertical and horizontal tabs);
// Attach the long click popup to all of them.
@@ -234,7 +247,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
const newTab2 = this.newTabButton;
const newTabVertical = document.getElementById(
"vertical-tabs-newtab-button"
@@ -1855,7 +1892,7 @@
@@ -1855,7 +1890,7 @@
let rect = ele => {
return window.windowUtils.getBoundsWithoutFlushing(ele);
};
@@ -243,7 +256,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
if (tab && rect(tab).width <= this._tabClipWidth) {
this.setAttribute("closebuttons", "activetab");
} else {
@@ -1867,10 +1904,12 @@
@@ -1867,10 +1902,12 @@
_handleTabSelect(aInstant) {
let selectedTab = this.selectedItem;
@@ -256,7 +269,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
selectedTab._notselectedsinceload = false;
}
@@ -1882,7 +1921,7 @@
@@ -1882,7 +1919,7 @@
return;
}
@@ -265,7 +278,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
if (!tabs.length) {
return;
}
@@ -1918,7 +1957,7 @@
@@ -1918,7 +1955,7 @@
if (isEndTab && !this._hasTabTempMaxWidth) {
return;
}
@@ -274,7 +287,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
// Force tabs to stay the same width, unless we're closing the last tab,
// which case we need to let them expand just enough so that the overall
// tabbar width is the same.
@@ -1933,7 +1972,7 @@
@@ -1933,7 +1970,7 @@
let tabsToReset = [];
for (let i = numPinned; i < tabs.length; i++) {
let tab = tabs[i];
@@ -283,7 +296,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
if (!isEndTab) {
// keep tabs the same width
tab.style.transition = "none";
@@ -1999,16 +2038,15 @@
@@ -1999,16 +2036,15 @@
// Move pinned tabs to another container when the tabstrip is toggled to vertical
// and when session restore code calls _positionPinnedTabs; update styling whenever
// the number of pinned tabs changes.
@@ -302,11 +315,11 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
for (let i = 0; i < numPinned; i++) {
tabs[i].style.marginInlineStart = "";
- verticalTabsContainer.appendChild(tabs[i]);
+ tabs[i].hasAttribute("zen-essential") ? document.getElementById("zen-essentials-container").appendChild(tabs[i]) : verticalTabsContainer.insertBefore(tabs[i], verticalTabsContainer.lastChild);
+ tabs[i].hasAttribute("zen-essential") ? document.getElementById("zen-essentials-container").appendChild(tabs[i].group?.hasAttribute("split-view-group") ? tabs[i].group : tabs[i]) : verticalTabsContainer.insertBefore(tabs[i].group?.hasAttribute("split-view-group") ? tabs[i].group : tabs[i], verticalTabsContainer.lastChild);
}
}
@@ -2016,9 +2054,7 @@
@@ -2016,9 +2052,7 @@
}
_resetVerticalPinnedTabs() {
@@ -317,7 +330,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
if (!verticalTabsContainer.children.length) {
return;
@@ -2031,8 +2067,8 @@
@@ -2031,8 +2065,8 @@
}
_positionPinnedTabs() {
@@ -328,15 +341,16 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
let absPositionHorizontalTabs =
this.overflowing && tabs.length > numPinned && numPinned > 0;
@@ -2042,6 +2078,7 @@
@@ -2041,7 +2075,7 @@
if (this.verticalMode) {
this._updateVerticalPinnedTabs();
} else if (absPositionHorizontalTabs) {
+ return;
- } else if (absPositionHorizontalTabs) {
+ } else if (absPositionHorizontalTabs && false) {
let layoutData = this._pinnedTabsLayoutCache;
let uiDensity = document.documentElement.getAttribute("uidensity");
if (!layoutData || layoutData.uiDensity != uiDensity) {
@@ -2113,7 +2150,7 @@
@@ -2113,7 +2147,7 @@
return;
}
@@ -345,7 +359,16 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
let directionX = screenX > dragData.animLastScreenX;
let directionY = screenY > dragData.animLastScreenY;
@@ -2296,10 +2333,11 @@
@@ -2121,7 +2155,7 @@
dragData.animLastScreenX = screenX;
let { width: tabWidth, height: tabHeight } =
- draggedTab.getBoundingClientRect();
+ (draggedTab.group?.hasAttribute("split-view-group") ? draggedTab.group : draggedTab).getBoundingClientRect();
let shiftSizeX = tabWidth * movingTabs.length;
let shiftSizeY = tabHeight;
dragData.tabWidth = tabWidth;
@@ -2296,10 +2330,11 @@
}
let pinned = draggedTab.pinned;
@@ -357,11 +380,44 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
+ let essential = draggedTab.hasAttribute("zen-essential");
+ let tabs = this.visibleTabs.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(
+ pinned ? (essential ? 0 : gBrowser._numZenVisibleEssentials) : numPinned,
+ pinned ? (essential ? gBrowser._numZenVisibleEssentials : ((numPinned - gBrowser._numZenVisibleEssentials) + 1)) : undefined
+ pinned ? (essential ? gBrowser._numZenVisibleEssentials : numPinned) : undefined
);
if (this.#rtlMode) {
@@ -2541,8 +2579,9 @@
@@ -2347,8 +2382,12 @@
(lastMovingTabScreen + tabSize);
translate = Math.min(Math.max(translate, firstBound), lastBound);
- for (let tab of movingTabs) {
- tab.style.transform = `${translateAxis}(${translate}px)`;
+ if (draggedTab.group?.hasAttribute("split-view-group")) {
+ draggedTab.group.style.transform = `${translateAxis}(${translate}px)`;
+ } else {
+ for (let tab of movingTabs) {
+ tab.style.transform = `${translateAxis}(${translate}px)`;
+ }
}
dragData.translatePos = translate;
@@ -2484,12 +2523,16 @@
// Shift background tabs to leave a gap where the dragged tab
// would currently be dropped.
for (let tab of tabs) {
- if (tab == draggedTab) {
+ if (tab == draggedTab || (tab.group?.hasAttribute("split-view-group") && tab.group == draggedTab.group)) {
continue;
}
let shift = getTabShift(tab, newIndex);
let transform = shift ? `${translateAxis}(${shift}px)` : "";
+ if (tab.group?.hasAttribute("split-view-group")) {
+ tab.group.style.transform = transform;
+ } else {
tab.style.transform = transform;
+ }
if (tab.group?.tabs[0] == tab) {
tab.group.style.setProperty(
"--tabgroup-dragover-transform",
@@ -2541,8 +2584,9 @@
);
}
@@ -373,7 +429,15 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
return;
}
@@ -2604,7 +2643,7 @@
@@ -2553,6 +2597,7 @@
tab.style.transform = "";
if (tab.group) {
tab.group.style.removeProperty("--tabgroup-dragover-transform");
+ tab.group.style.transform = "";
}
tab.removeAttribute("dragover-createGroup");
}
@@ -2604,7 +2649,7 @@
movingTab._moveTogetherSelectedTabsData.newIndex = movingTabNewIndex;
movingTab._moveTogetherSelectedTabsData.animate = false;
};
@@ -382,7 +446,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
postTransitionCleanup();
} else {
let onTransitionEnd = transitionendEvent => {
@@ -2707,9 +2746,9 @@
@@ -2707,9 +2752,9 @@
function newIndex(aTab, index) {
// Don't allow mixing pinned and unpinned tabs.
if (aTab.pinned) {
@@ -394,7 +458,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..0d4c63aa336172cbee0c4feb7eed4295
}
}
@@ -2793,7 +2832,7 @@
@@ -2793,7 +2838,7 @@
}
_notifyBackgroundTab(aTab) {

View File

@@ -1,5 +1,5 @@
diff --git a/browser/themes/shared/tabbrowser/tabs.css b/browser/themes/shared/tabbrowser/tabs.css
index 01815c2114a627e5cac183c702bd82f1bd4f58f8..e8eaca11afe18555a8d6421e75b4da92d6ddf693 100644
index 01815c2114a627e5cac183c702bd82f1bd4f58f8..3a453164ee8a555db2a0ba28288d69857a4933bc 100644
--- a/browser/themes/shared/tabbrowser/tabs.css
+++ b/browser/themes/shared/tabbrowser/tabs.css
@@ -31,7 +31,7 @@
@@ -37,6 +37,15 @@ index 01815c2114a627e5cac183c702bd82f1bd4f58f8..e8eaca11afe18555a8d6421e75b4da92
&::before {
position: absolute;
@@ -502,7 +501,7 @@
z-index: 1; /* Overlay tab title */
#tabbrowser-tabs[orient=vertical] & {
- top: 7px;
+ top: 0px;
}
&[crashed] {
@@ -617,14 +616,14 @@
}

View File

@@ -1,8 +1,8 @@
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index ce2393978f77f55f42ae9b97e5d40328ce8eaae4..a426679de76c2d172974ec87f5fe48e22d5ab7b0 100644
index a9863858f9a28b2c633edd9689d4379203eef1e6..7ac24baf70727a2a9be428c6f98763f312a0969b 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -18060,7 +18060,7 @@
@@ -18305,7 +18305,7 @@
# Whether we use the mica backdrop. Off by default for now.
- name: widget.windows.mica
type: bool
@@ -11,7 +11,7 @@ index ce2393978f77f55f42ae9b97e5d40328ce8eaae4..a426679de76c2d172974ec87f5fe48e2
mirror: once
#endif
@@ -18173,6 +18173,19 @@
@@ -18418,6 +18418,26 @@
mirror: always
#endif
@@ -21,6 +21,13 @@ index ce2393978f77f55f42ae9b97e5d40328ce8eaae4..a426679de76c2d172974ec87f5fe48e2
+ value: true
+ mirror: never
+
+#ifdef XP_MACOSX
+- name: zen.widget.macos.window-material
+ type: uint32_t
+ value: 1
+ mirror: always
+#endif
+
+#ifdef XP_WIN
+- name: zen.widget.windows.acrylic
+ type: bool

View File

@@ -1,13 +1,53 @@
diff --git a/widget/cocoa/VibrancyManager.mm b/widget/cocoa/VibrancyManager.mm
index e8263ee480a0249cae760ee5b9037bb87acafecc..aefc887208659e46191eebfde1f9f74f1eac77a5 100644
index 849b62c9976a7bc5fee35e074e54c8f556ed9c38..a9742c7ff30d417a18f41f9c120259192f33a0fd 100644
--- a/widget/cocoa/VibrancyManager.mm
+++ b/widget/cocoa/VibrancyManager.mm
@@ -39,7 +39,7 @@ static NSVisualEffectMaterial VisualEffectMaterialForVibrancyType(
@@ -13,6 +13,7 @@
#include "nsChildView.h"
#include "mozilla/StaticPrefs_widget.h"
+#include "mozilla/StaticPrefs_zen.h"
using namespace mozilla;
@@ -40,7 +41,23 @@ static NSVisualEffectMaterial VisualEffectMaterialForVibrancyType(
case VibrancyType::Sidebar:
return NSVisualEffectMaterialSidebar;
case VibrancyType::Titlebar:
- return NSVisualEffectMaterialTitlebar;
+ return NSVisualEffectMaterialUnderWindowBackground;
+ switch (StaticPrefs::zen_widget_macos_window_material()) {
+ case 1:
+ return NSVisualEffectMaterialHUDWindow;
+ case 2:
+ return NSVisualEffectMaterialFullScreenUI;
+ case 3:
+ return NSVisualEffectMaterialPopover;
+ case 4:
+ return NSVisualEffectMaterialMenu;
+ case 5:
+ return NSVisualEffectMaterialToolTip;
+ case 6:
+ return NSVisualEffectMaterialHeaderView;
+ case 7:
+ default:
+ return NSVisualEffectMaterialUnderWindowBackground;
+ }
}
}
@@ -78,6 +95,7 @@ - (NSView*)hitTest:(NSPoint)aPoint {
- (void)prefChanged {
self.blendingMode = VisualEffectBlendingModeForVibrancyType(mType);
+ self.material = VisualEffectMaterialForVibrancyType(mType);
}
@end
@@ -88,6 +106,7 @@ static void PrefChanged(const char* aPref, void* aClosure) {
static constexpr nsLiteralCString kObservedPrefs[] = {
"widget.macos.sidebar-blend-mode.behind-window"_ns,
"widget.macos.titlebar-blend-mode.behind-window"_ns,
+ "zen.widget.macos.window-material"_ns,
};
VibrancyManager::VibrancyManager(const nsChildView& aCoordinateConverter,