fix: Prevent watermark to run when chrome is hidden, b=bug #12364, c=common, workspaces

This commit is contained in:
mr. m
2026-02-27 16:27:48 +01:00
parent 1a1804d2be
commit f52eeb0d60
3 changed files with 11 additions and 4 deletions

View File

@@ -19,6 +19,13 @@ class ZenStartup {
this.#zenInitBrowserLayout();
}
get #shouldUseWatermark() {
return (
Services.prefs.getBoolPref("zen.watermark.enabled", false) &&
gZenWorkspaces.shouldHaveWorkspaces
);
}
#initBrowserBackground() {
const background = document.createXULElement("box");
background.id = "zen-browser-background";
@@ -102,7 +109,7 @@ class ZenStartup {
}
openWatermark() {
if (!Services.prefs.getBoolPref("zen.watermark.enabled", false)) {
if (!this.#shouldUseWatermark) {
document.documentElement.removeAttribute("zen-before-loaded");
return;
}
@@ -113,7 +120,7 @@ class ZenStartup {
closeWatermark() {
document.documentElement.removeAttribute("zen-before-loaded");
if (Services.prefs.getBoolPref("zen.watermark.enabled", false)) {
if (this.#shouldUseWatermark) {
let elementsToIgnore = this.#watermarkIgnoreElements.map((id) => "#" + id).join(", ");
gZenUIManager.motion
.animate(

View File

@@ -218,7 +218,8 @@ class nsZenWindowSync {
if (
!forcedSync &&
(hasUnsyncedArg ||
(typeof aWindow.arguments[0] === "string" &&
!aWindow.gZenWorkspaces.shouldHaveWorkspaces ||
(typeof aWindow.arguments?.[0] === "string" &&
aWindow.arguments.length > 1 &&
!!this.#browserWindowsList.length))
) {

View File

@@ -778,7 +778,6 @@ class nsZenWorkspaces {
this._shouldHaveWorkspaces =
chromeFlags & Ci.nsIWebBrowserChrome.CHROME_TOOLBAR ||
chromeFlags & Ci.nsIWebBrowserChrome.CHROME_MENUBAR;
return this._shouldHaveWorkspaces;
}
return this._shouldHaveWorkspaces && !document.documentElement.hasAttribute("taskbartab");
}