Skip to content

WebView: withMinimumDeviceScaleFactor — fix blur on low-DPI displays (pageZoom / RasterizationScale)#38

Merged
jakepenn merged 1 commit into
minimal_masterfrom
webview-pagezoom-fix
Jun 10, 2026
Merged

WebView: withMinimumDeviceScaleFactor — fix blur on low-DPI displays (pageZoom / RasterizationScale)#38
jakepenn merged 1 commit into
minimal_masterfrom
webview-pagezoom-fix

Conversation

@jakepenn

@jakepenn jakepenn commented Jun 5, 2026

Copy link
Copy Markdown
Member

Problem

The player webview renders blurry on low-DPI (non-Retina / 100%) displays. Confirmed on a secondary 1920×1080 monitor: devicePixelRatio = 1, CSS viewport 1323, fit scale(1.467) — the fixed-size design is upscaled with no backing-resolution headroom.

Change

Adds withMinimumDeviceScaleFactor(double) to both AppleWkWebView and WinWebView2 — a floor on the WebView's effective render scale, via public APIs:

  • macOS: WKWebView.pageZoom (macOS 11+), applied as max(1, min/backingScaleFactor) in viewDidChangeBackingProperties (tracks display moves; no-op on Retina).
  • Windows: ICoreWebView2Controller3::put_RasterizationScale = max(min, monitorScale), monitor auto-detection disabled, re-applied from the scale-factor notifier.

Both re-rasterise content at higher density and shrink the CSS viewport, so this is documented as responsive-content-only. Verified on macOS: with .withMinimumDeviceScaleFactor(2.0), the same monitor reports viewport 661 / fit scale(0.733) — the design now downscales off a 2×-rendered page → sharp.

Consumer opt-in is in minimal_core (MKUEmbeddedWebView).

Testing

macOS AU/VST3/Standalone green; blur confirmed cleared on a real 1× secondary monitor. Windows path unbuilt (no toolchain) — needs a Windows compile.

🤖 Generated with Claude Code

…-DPI

Floors the WebView's effective render scale so content stays sharp when the host
scales the editor up on a low-DPI display, where the OS otherwise upscales a 1x
raster (blurry, most visibly text). A high-DPI display already exceeds the floor,
so it's a no-op there. Both backends shrink the CSS viewport, so the option is
documented as responsive-content-only.

- macOS: public WKWebView.pageZoom (macOS 11+), applied as max(1, min/backing) in
  viewDidChangeBackingProperties so it tracks display moves and no-ops on Retina.
- Windows: public ICoreWebView2Controller3::put_RasterizationScale = max(min,
  monitorScale), with ShouldDetectMonitorScaleChanges off and re-applied from the
  scale-factor notifier.

No private SPI; both levers are documented public API.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jakepenn jakepenn merged commit ef67ec0 into minimal_master Jun 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant