Keep the display scale when a page replaces itself during its load

The engine applied device emulation at did-finish-load. Each new
document gets a renderer widget without emulation. Google replaces its
first document with ?zx=... before that document finishes. Thus the
first document kept a scale of 1, and the page grew by the display
scale when the second document finished.

The engine now also applies emulation when a main-frame document
commits. In the real app at 125%, Google keeps the same size before and
after its second document. Card 40a8db13.
This commit is contained in:
Knotty Wyvern
2026-10-31 19:06:45 -07:00
parent 28661f28bc
commit 19ef8f2e15
+3 -1
View File
@@ -166,7 +166,9 @@ export async function createEngine({ directory, emit = () => {}, canEmitFrame =
changed();
}
});
wc.on('did-navigate', (_event, url) => { store.visit(profileId, url, item.title); changed(); });
// Each new document gets a renderer widget without device emulation. A page that replaces itself before it finishes
// loading, as Google does, otherwise keeps a scale of 1 and grows when the next document finishes.
wc.on('did-navigate', (_event, url) => { emulateViewport(item); store.visit(profileId, url, item.title); changed(); });
wc.on('did-navigate-in-page', (_event, _url, main) => { if (main) { item.epoch++; agent.revokeAll(); } changed(); });
wc.on('page-title-updated', (_event, title) => { item.title = title.slice(0, 200); changed(); });
wc.on('page-favicon-updated', (_event, urls) => {