diff --git a/crates/render-foundation/src/image_cache.rs b/crates/render-foundation/src/image_cache.rs index 3c5387ce1..164014c93 100644 --- a/crates/render-foundation/src/image_cache.rs +++ b/crates/render-foundation/src/image_cache.rs @@ -2187,7 +2187,15 @@ mod decode_tests { /// 分发器:按魔数字节/内容正确路由 PNG / JPEG / WebP / SVG / 未知格式。 #[test] - fn decode_image_bytes_dispatches_by_magic() { + #[test] + fn decode_data_uri_svg_background() { + // bing-t5(C4):data-URI SVG background-image 解码管线——URL-encoded SVG + let src = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2210%22%20height%3D%2210%22%3E%3Crect%20width%3D%2210%22%20height%3D%2210%22%20fill%3D%22red%22%2F%3E%3C%2Fsvg%3E"; + let img = decode_data_uri(&src).expect("SVG data-URI should decode"); + assert!(img.width > 0 && img.height > 0, "SVG 应栅格化为位图"); + } + + fn test_decode_image_bytes_dispatches_by_magic() { // PNG → 成功 let png = red_2x2_png(); let img = decode_image_bytes(&png).expect("PNG should dispatch and decode"); diff --git a/crates/webview/src/async_load.rs b/crates/webview/src/async_load.rs index 8972655d5..a9e2cf839 100644 --- a/crates/webview/src/async_load.rs +++ b/crates/webview/src/async_load.rs @@ -575,7 +575,6 @@ impl AsyncPageLoad { // bing-t5(C3+C4 根因):CSS Custom Properties var() 替换—— // 在进入渲染前做文本级替换(collect --name: value → substitute var(--name, fallback))。 let css_for_render = substitute_css_vars_text(&self.css); - self.render_session = Some(BudgetedRenderSession::new(html, css_for_render)); } let session = self.render_session.as_mut().expect("session");