Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): picture-in-picture stays sharp when the preview is scaled down #31568

Closedwimjan123(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/31568/headopened View on GitHub

Showing 3 changed files with 82 additions and 37 deletions.

x
0 of 3 viewed, 3 left
49 additions and 37 deletionsapps/web/src/browser/HostedBrowserWebview.tsxModified
View file
@@ -16,6 +16,7 @@
import {
browserViewportSettingKey,
resolveBrowserViewportLayout,
+ resolveBrowserViewportTransform,
resolveFittedBrowserViewport,
} from "./browserViewportLayout";
import { BrowserDeviceToolbar } from "./BrowserDeviceToolbar";
@@ -303,6 +304,8 @@
if (!clientSettingsHydrated || !config) return null;
​
const renderingActive = active || backgroundActivity || pictureInPicture || recordingActive;
+ // Picture-in-picture frames are captures of this guest, so they need its full raster detail.
+ const viewportTransform = resolveBrowserViewportTransform(layout.viewportScale, pictureInPicture);
const wrapperStyle = resolveHostedBrowserWebviewWrapperStyle({
active,
renderingActive,
@@ -333,47 +336,56 @@
onChange={commitViewportChange}
) : null}
- <webview
- key={webviewGeneration}
- ref={setWebviewRef}
- // Electron needs allowpopups at attachment. React drops boolean values for unknown attributes.
- {...({ allowpopups: "true" } as unknown as { readonly allowpopups?: boolean })}
- src={webviewGeneration === 0 ? initialSrc : recoverySrc}
- partition={config.partition}