Merge branch 'dev' into glance-buttons-overflow

This commit is contained in:
mr. m
2025-03-02 15:45:11 +01:00
committed by GitHub
25 changed files with 696 additions and 33 deletions

View File

@@ -10,7 +10,7 @@
</hbox>
<hbox>
<toolbarbutton id="zen-sidebar-web-panel-home" class="toolbarbutton-1 chromeclass-toolbar-additional" oncommand="gZenBrowserManagerSidebar.home();"/>
<toolbarbutton id="zen-sidebar-web-panel-pinned" class="toolbarbutton-1 chromeclass-toolbar-additional" oncommand="gZenBrowserManagerSidebar.togglePinned(this);"/>
<toolbarbutton id="zen-sidebar-web-panel-pinned" class="toolbarbutton-1 chromeclass-toolbar-additional" pinned="true" oncommand="gZenBrowserManagerSidebar.togglePinned(this);"/>
<toolbarbutton id="zen-sidebar-web-panel-close" class="toolbarbutton-1 chromeclass-toolbar-additional" oncommand="gZenBrowserManagerSidebar.close();"/>
</hbox>
</toolbar>

View File

@@ -28,7 +28,12 @@ tab-group[split-view-group] {
--tab-min-height: 28px;
}
container-type: inline-size;
container-name: browser-tab;
flex: 1 !important;
padding-inline: 2px !important;
overflow: clip;
&:not(:last-child)::after {
content: '';
@@ -75,10 +80,18 @@ tab-group[split-view-group] {
background-color: var(--zen-toolbar-element-bg);
}
& .tab-close-button {
& .tab-close-button,
& .tab-reset-button {
margin-inline-end: -3px !important;
display: none !important;
}
@container browser-tab (min-width: 70px) {
:root[zen-sidebar-expanded='true'] &:hover > .tabbrowser-tab:not([pinned]) .tab-close-button {
display: block !important;
}
}
@media (prefers-reduced-motion: no-preference) {
#tabbrowser-tabs[movingtab] & {
transition: var(--tab-dragover-transition);

View File

@@ -600,7 +600,7 @@
&:is(:hover, [visuallyselected]) .tab-close-button {
display: block;
--tab-inline-padding: 0; /* Avoid weird padding */
margin-inline-end: 0 !important;
margin-inline-end: 0;
}
.tab-throbber,
@@ -888,7 +888,6 @@
.reset-icon,
.tab-reset-pin-button {
appearance: none;
}
@media not (forced-colors) {

View File

@@ -8,20 +8,49 @@
document.addEventListener('TabGrouped', this.#onTabGrouped.bind(this));
document.addEventListener('TabUngrouped', this.#onTabUngrouped.bind(this));
document.addEventListener('TabGroupRemoved', this.#onTabGroupRemoved.bind(this));
document.addEventListener('TabGroupCreate', this.#onTabGroupCreate.bind(this));
}
#onTabGrouped(event) {
const tab = event.target;
const group = tab.group;
group.pinned = tab.pinned;
if (group.hasAttribute('split-view-group') && group.hasAttribute('zen-pinned-changed')) {
// zen-pinned-changed remove it and set it to had-zen-pinned-changed to keep
// track of the original pinned state
group.removeAttribute('zen-pinned-changed');
group.setAttribute('had-zen-pinned-changed', true);
}
}
#onTabUngrouped(event) {}
#onTabUngrouped(event) {
const tab = event.target;
const group = event.detail;
if (group.hasAttribute('split-view-group') && tab.hasAttribute('had-zen-pinned-changed')) {
tab.setAttribute('zen-pinned-changed', true);
tab.removeAttribute('had-zen-pinned-changed');
}
}
#onTabGroupCreate(event) {
const group = event.target;
const tabs = group.tabs;
if (!group.pinned) {
return;
}
for (const tab of tabs) {
if (tab.hasAttribute('zen-pinned-changed')) {
tab.removeAttribute('zen-pinned-changed');
tab.setAttribute('had-zen-pinned-changed', true);
}
}
}
#onTabGroupRemoved(event) {}
expandGroupTabs(group) {
for (const tab of group.tabs) {
for (const tab of group.tabs.reverse()) {
gBrowser.ungroupTab(tab);
}
}
@@ -31,15 +60,20 @@
if (!group) {
return false;
}
if (group.hasAttribute('split-view-group')) {
for (const tab of group.tabs) {
tab.setAttribute('pinned', 'true');
if (group.hasAttribute('split-view-group') && !this._piningFolder) {
this._piningFolder = true;
for (const otherTab of group.tabs) {
if (tab === otherTab) {
continue;
}
gBrowser.pinTab(otherTab);
}
this._piningFolder = false;
gBrowser.verticalPinnedTabsContainer.insertBefore(group, gBrowser.verticalPinnedTabsContainer.lastChild);
gBrowser.tabContainer._invalidateCachedTabs();
return true;
}
return false;
return this._piningFolder;
}
handleTabUnpin(tab) {
@@ -47,15 +81,20 @@
if (!group) {
return false;
}
if (group.hasAttribute('split-view-group')) {
for (const tab of group.tabs) {
tab.removeAttribute('pinned');
if (group.hasAttribute('split-view-group') && !this._piningFolder) {
this._piningFolder = true;
for (const otherTab of group.tabs) {
if (tab === otherTab) {
continue;
}
gBrowser.unpinTab(otherTab);
}
this._piningFolder = false;
ZenWorkspaces.activeWorkspaceStrip.prepend(group);
gBrowser.tabContainer._invalidateCachedTabs();
return true;
}
return false;
return this._piningFolder;
}
}

View File

@@ -94,7 +94,7 @@
//const pin = this._pinsCache.find((pin) => pin.uuid === tab.getAttribute('zen-pin-id'));
//if (pin) {
// pin.iconUrl = iconUrl;
// ZenPinnedTabsStorage.savePin(pin);
// this.savePin(pin);
//}
}
@@ -289,7 +289,7 @@
container.insertBefore(newTab, container.lastChild);
}
} else {
document.getElementById('zen-essentials-container').prepend(newTab);
document.getElementById('zen-essentials-container').appendChild(newTab);
}
gBrowser.tabContainer._invalidateCachedTabs();
newTab.initialize();
@@ -339,13 +339,13 @@
tab.position = tab._tPos;
for (let otherTab of gBrowser.tabs) {
if (otherTab.pinned && otherTab._tPos > tab.position) {
if (otherTab.pinned) {
const actualPin = this._pinsCache.find((pin) => pin.uuid === otherTab.getAttribute('zen-pin-id'));
if (!actualPin) {
continue;
}
actualPin.position = otherTab._tPos;
await ZenPinnedTabsStorage.savePin(actualPin, false);
await this.savePin(actualPin, false);
}
}
@@ -355,7 +355,8 @@
return;
}
actualPin.position = tab.position;
await ZenPinnedTabsStorage.savePin(actualPin);
actualPin.isEssential = tab.hasAttribute('zen-essential');
await this.savePin(actualPin);
}
_onTabClick(e) {
@@ -398,7 +399,7 @@
pin.workspaceUuid = tab.getAttribute('zen-workspace-id');
pin.userContextId = userContextId ? parseInt(userContextId, 10) : 0;
await ZenPinnedTabsStorage.savePin(pin);
await this.savePin(pin);
this.resetPinChangedUrl(tab);
await this._refreshPinnedTabs();
gZenUIManager.showToast('zen-pinned-tab-replaced');
@@ -421,7 +422,7 @@
entry = JSON.parse(tab.getAttribute('zen-pinned-entry'));
}
await ZenPinnedTabsStorage.savePin({
await this.savePin({
uuid,
title: entry?.title || tab.label || browser.contentTitle,
url: entry?.url || browser.currentURI.spec,
@@ -474,6 +475,15 @@
}
}
async savePin(pin, notifyObservers = true) {
await ZenPinnedTabsStorage.savePin(pin, notifyObservers);
// Update the cache
const existingPin = this._pinsCache.find((p) => p.uuid === pin.uuid);
if (existingPin) {
Object.assign(existingPin, pin);
}
}
_onCloseTabShortcut(event, selectedTab = gBrowser.selectedTab, behavior = lazy.zenPinnedTabCloseShortcutBehavior) {
if (!selectedTab?.pinned) {
return;
@@ -604,7 +614,7 @@
const pin = this._pinsCache.find((pin) => pin.uuid === tab.getAttribute('zen-pin-id'));
if (pin) {
pin.isEssential = true;
ZenPinnedTabsStorage.savePin(pin);
this.savePin(pin);
}
document.getElementById('zen-essentials-container').appendChild(tab);
gBrowser.tabContainer._invalidateCachedTabs();
@@ -622,8 +632,8 @@
for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i];
tab.removeAttribute('zen-essential');
if (ZenWorkspaces.workspaceEnabled && ZenWorkspaces.getActiveWorkspaceFromCache.uuid) {
tab.setAttribute('zen-workspace-id', ZenWorkspaces.getActiveWorkspaceFromCache.uuid);
if (ZenWorkspaces.workspaceEnabled && ZenWorkspaces.getActiveWorkspaceFromCache().uuid) {
tab.setAttribute('zen-workspace-id', ZenWorkspaces.getActiveWorkspaceFromCache().uuid);
}
if (unpin) {
gBrowser.unpinTab(tab);
@@ -781,6 +791,7 @@
return;
}
tab.removeAttribute('zen-pinned-changed');
tab.removeAttribute('had-zen-pinned-changed');
tab.style.removeProperty('--zen-original-tab-icon');
}
@@ -788,7 +799,11 @@
if (tab.hasAttribute('zen-pinned-changed')) {
return;
}
tab.setAttribute('zen-pinned-changed', 'true');
if (tab.group?.hasAttribute('split-view-group')) {
tab.setAttribute('had-zen-pinned-changed', 'true');
} else {
tab.setAttribute('zen-pinned-changed', 'true');
}
tab.style.setProperty('--zen-original-tab-icon', `url(${pin.iconUrl})`);
}

View File

@@ -33,6 +33,7 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
this.listenForPrefChanges();
this.insertIntoContextMenu();
this.addPositioningListeners();
this.syncPinnedState();
}
onlySafeWidthAndHeight() {
@@ -98,6 +99,17 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
window.addEventListener('resize', this.onWindowResize.bind(this));
}
syncPinnedState() {
const sidebar = document.getElementById('zen-sidebar-web-panel');
const pinButton = document.getElementById('zen-sidebar-web-panel-pinned');
if (sidebar.hasAttribute('pinned')) {
pinButton.setAttribute('pinned', 'true');
} else {
pinButton.removeAttribute('pinned');
}
}
handleSplitterMouseDown(mouseDownEvent) {
if (this._isDragging) return;
this._isDragging = true;

View File

@@ -709,7 +709,9 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
*/
splitTabs(tabs, gridType) {
const firstisPinned = tabs[0].pinned;
tabs = tabs.filter((t) => t.pinned === firstisPinned && !t.hidden && !t.hasAttribute('zen-empty-tab'));
tabs = tabs.filter(
(t) => t.pinned === firstisPinned && !t.hidden && !t.hasAttribute('zen-empty-tab') && !t.hasAttribute('zen-essential')
);
if (tabs.length < 2 || tabs.length > this.MAX_TABS) {
return;
}

View File

@@ -1493,9 +1493,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this._inChangingWorkspace = true;
try {
await this._performWorkspaceChange(window, ...args);
} finally {
this._inChangingWorkspace = false;
} catch (e) {
console.error('ZenWorkspaces: Error changing workspace', e);
}
this._inChangingWorkspace = false;
}
_cancelSwipeAnimation() {
@@ -1630,7 +1631,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
const elementWorkspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === elementWorkspaceId);
const offset = -(newWorkspaceIndex - elementWorkspaceIndex) * 100;
const newTransform = `translateX(${offset}%)`;
const isCurrent = offset === 0;
if (shouldAnimate) {
element.removeAttribute('hidden');
animations.push(

View File

@@ -0,0 +1,12 @@
diff --git a/browser/components/BrowserContentHandler.sys.mjs b/browser/components/BrowserContentHandler.sys.mjs
index 7aef091c0be1cb0ea0be52268949db17032f96d9..5e9105fa671d1b1979f204fc8d3be22771998ad7 100644
--- a/browser/components/BrowserContentHandler.sys.mjs
+++ b/browser/components/BrowserContentHandler.sys.mjs
@@ -1278,6 +1278,7 @@ function maybeRecordToHandleTelemetry(uri, isLaunch) {
".avif",
".htm",
".html",
+ ".jxl",
".pdf",
".shtml",
".xht",

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/places/PlacesUIUtils.sys.mjs b/browser/components/places/PlacesUIUtils.sys.mjs
index fbdd6a34b12d4d957f7a2d9d95df0bfd65ba3f61..4d27f7fc108ca76e071707a737209bf5ea4ea07e 100644
index fbdd6a34b12d4d957f7a2d9d95df0bfd65ba3f61..baaf34536f557c69fce3cc43e6f12658514db39f 100644
--- a/browser/components/places/PlacesUIUtils.sys.mjs
+++ b/browser/components/places/PlacesUIUtils.sys.mjs
@@ -58,6 +58,7 @@ class BookmarkState {
@@ -95,7 +95,7 @@ index fbdd6a34b12d4d957f7a2d9d95df0bfd65ba3f61..4d27f7fc108ca76e071707a737209bf5
+ const placeholders = workspacesToRemove.map(() => '?').join(',');
+ await db.execute(`
+ DELETE FROM zen_bookmarks_workspaces
+ WHERE bookmark_guid = :bookmark_guid
+ WHERE bookmark_guid = :bookmark_guid
+ AND workspace_uuid IN (${placeholders})
+ `, [bookmarkGuid, ...workspacesToRemove]);
+
@@ -157,12 +157,20 @@ index fbdd6a34b12d4d957f7a2d9d95df0bfd65ba3f61..4d27f7fc108ca76e071707a737209bf5
/**
* Append transactions to update tags by given information.
*
@@ -902,7 +1011,7 @@ export var PlacesUIUtils = {
@@ -902,8 +1011,15 @@ export var PlacesUIUtils = {
aNode,
aWhere,
aWindow,
- { aPrivate = false, userContextId = 0 } = {}
+ { aPrivate = false, userContextId = aWindow.ZenWorkspaces.getDefaultContainer() } = {}
+ { aPrivate = false, userContextId = undefined } = {}
) {
+ if (typeof userContextId == "undefined") {
+ try {
+ let browserWindow = getBrowserWindow(aWindow);
+ userContextId = browserWindow.ZenWorkspaces.getDefaultContainer();
+ } catch {}
+ }
+
if (
aNode &&
lazy.PlacesUtils.nodeIsURI(aNode) &&

View File

@@ -0,0 +1,12 @@
diff --git a/browser/installer/windows/msix/AppxManifest.xml.in b/browser/installer/windows/msix/AppxManifest.xml.in
index b81a73518a183b7b1d178793886c66f44651058d..89690a4177229b70013bcf35ec1d805fff7e1b26 100644
--- a/browser/installer/windows/msix/AppxManifest.xml.in
+++ b/browser/installer/windows/msix/AppxManifest.xml.in
@@ -61,6 +61,7 @@
<uap:FileType>.avif</uap:FileType>
<uap:FileType>.htm</uap:FileType>
<uap:FileType>.html</uap:FileType>
+ <uap:FileType>.jxl</uap:FileType>
<uap:FileType>.pdf</uap:FileType>
<uap:FileType>.shtml</uap:FileType>
<uap:FileType>.xht</uap:FileType>

View File

@@ -0,0 +1,46 @@
diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh
index b7f8e1453089ab5f1945e1a65f038e17b5273571..5297f5ed70fe3446e55be37df486fb4ad791a446 100644
--- a/browser/installer/windows/nsis/shared.nsh
+++ b/browser/installer/windows/nsis/shared.nsh
@@ -513,6 +513,7 @@ ${RemoveDefaultBrowserAgentShortcut}
${AddAssociationIfNoneExist} ".svg" "FirefoxHTML$5"
${AddAssociationIfNoneExist} ".webp" "FirefoxHTML$5"
${AddAssociationIfNoneExist} ".avif" "FirefoxHTML$5"
+ ${AddAssociationIfNoneExist} ".jxl" "FirefoxHTML$5"
${AddAssociationIfNoneExist} ".pdf" "FirefoxPDF$5"
@@ -609,6 +610,7 @@ ${RemoveDefaultBrowserAgentShortcut}
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".svg" "FirefoxHTML$2"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".webp" "FirefoxHTML$2"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".avif" "FirefoxHTML$2"
+ WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".jxl" "FirefoxHTML$2"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".pdf" "FirefoxPDF$2"
@@ -681,6 +683,7 @@ ${RemoveDefaultBrowserAgentShortcut}
${WriteApplicationsSupportedType} ${RegKey} ".webm"
${WriteApplicationsSupportedType} ${RegKey} ".webp"
${WriteApplicationsSupportedType} ${RegKey} ".avif"
+ ${WriteApplicationsSupportedType} ${RegKey} ".jxl"
${WriteApplicationsSupportedType} ${RegKey} ".xht"
${WriteApplicationsSupportedType} ${RegKey} ".xhtml"
${WriteApplicationsSupportedType} ${RegKey} ".xml"
@@ -1728,6 +1731,8 @@ Function SetAsDefaultAppUserHKCU
Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".avif" "file"
Pop $0
+ AppAssocReg::SetAppAsDefault "$R9" ".jxl" "file"
+ Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".xht" "file"
Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".xhtml" "file"
@@ -1857,7 +1862,7 @@ FunctionEnd
; uninstalled.
; Do all of that twice, once for the local machine and once for the current user
-
+
; Remove protocol handlers
ClearErrors
ReadRegStr $0 HKLM "Software\Classes\${_PROTOCOL}\DefaultIcon" ""

View File

@@ -0,0 +1,12 @@
diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi
index 559c8b46ee06bc42c91da49b5d9e397fe8ff6126..62094a5d98712a41a607ba01ca2adfa1e4f51ccd 100644
--- a/browser/installer/windows/nsis/uninstaller.nsi
+++ b/browser/installer/windows/nsis/uninstaller.nsi
@@ -507,6 +507,7 @@ Section "Uninstall"
${un.RegCleanFileHandler} ".svg" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".webp" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".avif" "FirefoxHTML-$AppUserModelID"
+ ${un.RegCleanFileHandler} ".jxl" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".pdf" "FirefoxPDF-$AppUserModelID"