mirror of
https://github.com/zen-browser/desktop.git
synced 2026-07-23 08:52:34 +00:00
gh-14461: Fix boost size override not persisting (gh-14664)
This commit is contained in:
@@ -659,7 +659,10 @@ ${cssSelector} {
|
||||
this.currentBoostData.sizeOverride = 0.9;
|
||||
} else if (this.currentBoostData.sizeOverride == 0.9) {
|
||||
this.currentBoostData.sizeOverride = 1;
|
||||
await this.zenBoostsChild.sendQuery("ZenBoost:DisableSizeOverride");
|
||||
await this.zenBoostsChild.updateBoostSizeOverride(
|
||||
this.currentBoostData.sizeOverride,
|
||||
/* disable: */ true
|
||||
);
|
||||
}
|
||||
|
||||
this.currentBoostData.changeWasMade = true;
|
||||
|
||||
@@ -280,9 +280,6 @@ export class ZenBoostsChild extends JSWindowActorChild {
|
||||
case "ZenBoost:OpenInspector":
|
||||
this.sendAsyncMessage("ZenBoost:OpenInspector");
|
||||
break;
|
||||
case "ZenBoost:DisableSizeOverride":
|
||||
this.disableSizeOverride();
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -359,13 +356,9 @@ export class ZenBoostsChild extends JSWindowActorChild {
|
||||
this.#loadStyleSheet(boost.styleSheet);
|
||||
}
|
||||
|
||||
if (
|
||||
boostData.sizeOverride &&
|
||||
isFinite(boostData.sizeOverride) &&
|
||||
boostData.sizeOverride !== 1
|
||||
) {
|
||||
browsingContext.fullZoom = boostData.sizeOverride;
|
||||
}
|
||||
this.sendAsyncMessage("ZenBoost:UpdateBoostSize", {
|
||||
sizeOverride: boostData.sizeOverride,
|
||||
});
|
||||
|
||||
browsingContext.isZenBoostsInverted = boostData.smartInvert;
|
||||
if (boostData.enableColorBoost) {
|
||||
@@ -552,14 +545,6 @@ export class ZenBoostsChild extends JSWindowActorChild {
|
||||
this.sendNotify("selector-picker-state-update", "ondisable");
|
||||
}
|
||||
|
||||
disableSizeOverride() {
|
||||
const browsingContext = this.browsingContext;
|
||||
if (!browsingContext || browsingContext.parent !== null) {
|
||||
return;
|
||||
}
|
||||
browsingContext.fullZoom = 1;
|
||||
}
|
||||
|
||||
sendNotify(topic, msg = null) {
|
||||
this.sendAsyncMessage("ZenBoost:Notify", { topic, msg });
|
||||
}
|
||||
|
||||
@@ -72,6 +72,23 @@ export class ZenBoostsParent extends JSWindowActorParent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the boost size override on webpage
|
||||
*
|
||||
* @param {number} sizeOverride - The size to apply on the webpage as a override
|
||||
* @param {boolean} disable - Whether to disable the override (sets override to the default 1)
|
||||
*/
|
||||
updateBoostSizeOverride(sizeOverride, disable = false) {
|
||||
if (
|
||||
sizeOverride &&
|
||||
isFinite(sizeOverride) &&
|
||||
(sizeOverride !== 1 || disable)
|
||||
) {
|
||||
const fullZoom = this.browsingContext.topChromeWindow.FullZoom;
|
||||
fullZoom.setZoom(sizeOverride);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles messages received from child actors.
|
||||
* Retrieves boost data for a domain when requested.
|
||||
@@ -174,6 +191,11 @@ export class ZenBoostsParent extends JSWindowActorParent {
|
||||
: null,
|
||||
};
|
||||
}
|
||||
case "ZenBoost:UpdateBoostSize": {
|
||||
const { sizeOverride } = message.data;
|
||||
this.updateBoostSizeOverride(sizeOverride);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
console.warn(`[ZenBoostsParent]: Unknown message: ${message.name}`);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user