Web source: CSS reset per document + (0,0) anchor — kill box-vs-content padding

This commit is contained in:
2026-08-28 10:41:33 -07:00
parent e917c41a48
commit 9d4103c44b
4 changed files with 27 additions and 10 deletions
+7
View File
@@ -923,6 +923,13 @@ canvas size (1920×1080) in `Register`, never tracking the element box — the O
box-sized viewport was the truncation bug. Display `Stretch`: web → `Uniform` (no crop),
everything else → `UniformToFill`. Graceful-error handling (item 9) is a follow-up.
**Box-vs-content padding (2026-08-28):** whitespace gaps between the bounding box and the web
content were the page's own UA margins/padding + body sizing to content instead of the viewport.
Fixed by injecting a CSS reset into every document via
`CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync` (margin/padding 0, html/body 100% of
viewport, overflow hidden, transparent bg) and anchoring the web `<Image>` at (0,0)
(`HorizontalAlignment/VerticalAlignment=Left/Top`) inside the element box.
### Design decisions
- WebView2 is the only option for Windows — it's pre-installed on Windows 10 20H2+ and Windows 11