Commit 5cd2be6
fix(v3/windows): keep host-owned rasterization scale under visual hosting (#5761)
* fix(v3/windows): keep host-owned scale under visual hosting
#5734 re-enabled WebView2 automatic monitor-scale detection
(ShouldDetectMonitorScaleChanges) unconditionally to fix the mixed-DPI
GPU-process crash. That is correct for the default windowed (HWND-child)
hosting mode, but wrong under UseVisualHosting
(COREWEBVIEW2_HOSTING_MODE_WINDOW_TO_VISUAL): the content is a
DirectComposition visual decoupled from the child HWND that automatic
detection tracks, so on a mixed-DPI monitor cross detection reads the
wrong monitor and settles the visual on a stale rasterization scale --
the whole UI renders shrunk (small fonts) until something forces a
re-layout.
Gate the detection-enable on hosting mode:
- windowed: enable detection (unchanged; keeps #5734's crash fix)
- visual hosting: explicitly disable detection so the host owns the
scale via resyncWebviewRasterizationScale (monitorScaleDetectionOn
stays false). The module leaves detection at its platform default
(enabled), so visual hosting must disable it explicitly -- merely
skipping the enable would leave both Edge's detection and the host
resync writing the scale (the two-writer race #5734 targets).
Host-owned scale is reliable now that the by-value PutRasterizationScale
bug (#5701) is fixed, and is the documented contract (WebView2Feedback
#3665: detection-off is correct when the host puts the scale on every
change).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(v3/windows): derive monitorScaleDetectionOn from actual controller state
Query GetShouldDetectMonitorScaleChanges after the Put and set the
single-writer flag from the controller's real state, not from the value
requested. A failed PutShouldDetectMonitorScaleChanges could leave
detection at its platform default (enabled) while monitorScaleDetectionOn
stayed false, so resyncWebviewRasterizationScale would keep writing
PutRasterizationScale concurrently with Edge — the two-writer scale(0,0)
race this change removes. If the query itself fails, assume detection may
be on and stand the host resync down.
Addresses review feedback on #5761.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>1 parent 7d90315 commit 5cd2be6
1 file changed
Lines changed: 49 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2383 | 2383 | | |
2384 | 2384 | | |
2385 | 2385 | | |
2386 | | - | |
2387 | | - | |
2388 | | - | |
2389 | | - | |
2390 | | - | |
2391 | | - | |
2392 | | - | |
2393 | | - | |
2394 | | - | |
2395 | | - | |
2396 | | - | |
2397 | | - | |
2398 | | - | |
2399 | | - | |
2400 | | - | |
2401 | | - | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
2402 | 2404 | | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
2403 | 2426 | | |
2404 | 2427 | | |
2405 | | - | |
2406 | | - | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
2407 | 2434 | | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
2408 | 2439 | | |
2409 | 2440 | | |
2410 | 2441 | | |
| |||
0 commit comments