mirror of
https://github.com/zen-browser/desktop.git
synced 2026-03-29 03:41:51 +00:00
fix: Prevent watermark to run when chrome is hidden, b=bug #12364, c=common, workspaces
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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))
|
||||
) {
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user