render: replay raw SVG fragments in native Skia PNG output#720
Closed
seo-rii wants to merge 1 commit intoedwardkim:develfrom
Closed
render: replay raw SVG fragments in native Skia PNG output#720seo-rii wants to merge 1 commit intoedwardkim:develfrom
seo-rii wants to merge 1 commit intoedwardkim:develfrom
Conversation
edwardkim
added a commit
that referenced
this pull request
May 9, 2026
본질: PR #599 (P4 PNG raster backend) + PR #626 (P5 equation replay) 후속의 P6 단계. native Skia 경로 영역 의 RawSvg leaf 영역 placeholder fallback 영역 → 실제 raster (resvg + tiny-skia 영역) 정합. 기존 (renderer.rs:763): PaintOp::RawSvg { bbox, .. } => draw_placeholder(*bbox, "svg") 정정: rasterize_svg_fragment_to_png + draw_image_bytes 영역 재사용 영역. 신규 함수 (image_conv.rs +82 LOC): - draw_svg_fragment(canvas, fragment, x, y, w, h, sampling) -> bool - rasterize_svg_fragment_to_png(fragment, w, h) -> Option<Vec<u8>> - svg_parse_options() -> usvg::Options<'static> renderer.rs:760+ (line +88/-6): - PaintOp::RawSvg { bbox, raw } 영역 의 draw_svg_fragment 호출 - invalid SVG 영역 fallback placeholder 영역 보존 보안 가드 (영향 좁힘): - MAX_SVG_FRAGMENT_BYTES = 4 MB (fragment 크기 가드) - MAX_SVG_RASTER_PIXELS = 67M (8192x8192 영역 raster 가드) - resolve_string = Box::new(|_, _| None) (external href 차단 — file:// / http:// / https:// 등) - resolve_data = usvg 기본 data: URI resolver (data: URI 만 허용) - resources_dir = None (디렉터리 자동 탐색 차단) - Wrapper SVG: <svg xmlns="..." width="..." height="..." viewBox="...">{fragment}</svg> 의존성 (Cargo.toml): - native-skia feature 영역 의 dep:resvg 추가 - resvg = { version = "0.45", optional = true } 회귀 가드 테스트 (2건 신규): - renders_raw_svg_fragment_as_colored_ink: green rect 100+ green 픽셀 검증 - raw_svg_replay_does_not_load_external_file_hrefs: 외부 file href 영역 red 0 픽셀 검증 (보안 가드 작동 입증) 영향 범위: - native Skia PNG/VLM 경로 영역 의 차트/OLE/내장 SVG 영역 fragment 영역 실제 렌더링 - WASM/browser SVG / CanvasKit / form replay 영역 무영향 (별건) - 다른 PaintOp 영역 (Image, Equation, Path, Text 등) 무영향 비목표 명시 (PR 본문): - browser/WASM SVG replay / CanvasKit raw SVG replay - full SVG security policy 설계 - network/file resource loading - animated SVG / SVG filter 전체 parity - form native replay / VLM preset 확장 (#613) - PNG DPI metadata (#614) 검증: - cargo test --release: lib 1173 + 통합 ALL GREEN, failed 0 - cargo test --release --features native-skia skia --lib: 24/24 PASS (신규 2건 회귀 가드 + 기존 22건) - cargo clippy --release --features native-skia --lib -- -D warnings: 통과 - 광범위 sweep 7 fixture / 170 페이지 / 회귀 0 (Skia 영역 무관 영역, native-skia 미사용 영역 sweep 정합 확정) @seo-rii 7번째 사이클 PR (Skia 영역 트래킹 #536 영역 의 단계적 진전 영역). PR #165 (skia 도입) → #419 (PageLayerTree) → #456 (Canvas 라우팅) → #498 (visual diff) → #599 (P4 PNG) → #626 (P5 equation) → #720 (P6 raw SVG). refs #536 Co-Authored-By: seorii <me@seorii.page> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
edwardkim
added a commit
that referenced
this pull request
May 9, 2026
- mydocs/pr/archives/pr_720_review.md (검토 문서) - mydocs/pr/archives/pr_720_report.md (처리 보고서) - mydocs/orders/20260510.md: 5/10 사이클 신규 + PR #720 행 처리 결과: - 옵션 A — 1 commit cherry-pick + no-ff merge (70121b1) - native Skia P6 단계: RawSvg fragment 영역 placeholder → 실제 raster (resvg) - 보안 가드 ✅ (4 MB / 67M / external href 차단) - 회귀 가드 2건 신규 + native-skia 24/24 PASS - 시각 판정 면제 (결정적 검증 + 회귀 가드 + 보안 가드 통과) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
|
@seo-rii PR 머지 완료되었습니다 (devel 처리 결과
검증
메모리 룰 정합
비목표 명시 정합 처리 보고서: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 요약
이번 PR은 render P6 단계로, native Skia PNG 경로에서
RawSvgleaf를 placeholder가 아니라 실제 raster content로 replay합니다.P5까지는 native Skia 경로가 image/equation까지 처리했고,
RawSvg는 fallback placeholder에 가까웠습니다. 이번 단계에서는RawSvgNode.svgfragment를 안전한 wrapper SVG로 감싼 뒤resvg/tiny-skia로 PNG rasterize하고, 그 결과를 기존 Skia image drawing 경로로 넘겨 bbox에 그립니다.주요 변경은 아래와 같습니다.
native-skiafeature에 optionalresvg의존성 추가PaintOp::RawSvgnative replay 처리draw_image_bytes경로로 draw이 PR은 native Skia PNG output에서 차트/OLE/내장 SVG성 fragment가 조용히 빠지는 문제를 줄이는 단계입니다. 다만 이것도 완전한 browser SVG renderer parity를 의미하지는 않습니다.
관련 이슈
refs #536
follow-up to #599 / #626
범위
이번 PR에 포함한 범위는 아래 정도입니다.
resvg기반 SVG fragment rasterization비목표
아래는 일부러 이번 PR에 넣지 않았습니다.
특히 raw SVG는 외부 리소스를 따라가지 않게 제한했습니다. PNG/VLM 경로에서 예측 가능한 raster output을 얻는 것이 우선입니다.
테스트
git diff --check upstream/devel..HEADcargo test --features native-skia skia --libcargo clippy --features native-skia --lib -- -D warnings스크린샷
없음.
이번 PR은 native PNG raster backend 내부 replay 보강입니다. 테스트에서는 raw SVG fragment가 실제 pixel ink로 찍히는지, 외부 href가 로드되지 않는지 확인합니다.