render: replay raw SVG fragments in native Skia PNG output#720
Closed
seo-rii wants to merge 1 commit into
Closed
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 처리 결과
검증
메모리 룰 정합
비목표 명시 정합 처리 보고서: |
edwardkim
added a commit
that referenced
this pull request
May 9, 2026
- mydocs/pr/archives/pr_725_review.md: 검토 문서 archives 이동 - mydocs/pr/archives/pr_725_report.md: 처리 보고서 작성 · cursor_rect.rs 영역 table_id 격리 + 중첩 표 cellPath 보존 · 회귀 가드 3건 신규 + 광범위 sweep 170/170 same · 시각 판정 면제 합리 (query API + 시각 출력 무영향) - mydocs/plans/archives/task_m100_717.md(_impl).md: plans archives 이동 - mydocs/orders/20260510.md: PR #725 항목 추가 (5/10 사이클 패턴 영역 영역 PR #720/#723/#725 영역 3건)
This was referenced May 9, 2026
edwardkim
added a commit
that referenced
this pull request
May 9, 2026
- mydocs/pr/archives/pr_734_review.md: 검토 문서 archives 이동 - mydocs/pr/archives/pr_734_report.md: 처리 보고서 작성 · export-png --dpi 옵션 (Issue #614 closes) · PNG pHYs chunk 영역 인쇄 워크플로우 메타데이터 · 작업지시자 실 sample 검증 통과 (samples/통합재정통계(2010.11월).hwp 영역 4 패턴) · 시각 판정 면제 합리 (PNG 메타데이터 영역 영역 픽셀 데이터 무영향) - mydocs/orders/20260510.md: PR #734 항목 추가 (5/10 사이클 영역 영역 8건 처리) - mydocs/manual/export_png_command.md: --dpi 옵션 매뉴얼 현행화 · 옵션 표 영역 --dpi 추가 · 옵션 우선순위 갱신 (--dpi auto-scale) · DPI 메타데이터 영역 영역 별도 절 추가 (PNG spec §11.3.5.3 정합) · 사용 예시 + 출력 dimension 표 갱신 (--dpi 300 영역 영역) · 출력 형식 영역 메타데이터 명시 · 비목표 영역 갱신 (PR #720/#734 영역 영역 진전 반영)
This was referenced May 9, 2026
edwardkim
added a commit
that referenced
this pull request
May 10, 2026
PR #740 (@oksure) 옵션 A 처리 — 4 commits cherry-pick + 자기 정정 + no-ff merge. 본질 정정 (1 file, +245/-2): - src/renderer/skia/renderer.rs (+245/-2): · 양식 개체 5종 정적 드로잉 (placeholder 영역 영역 실제 외형 변환) - PushButton: 둥근 사각형(RRect) + 중앙 캡션 - CheckBox: 사각 체크박스 + 체크마크(V자) + 캡션 - RadioButton: 원형 테두리 + 내부 점 + 캡션 - ComboBox: 입력 필드 + 드롭다운 화살표 + 텍스트 - Edit: 입력 필드 + 텍스트 · CSS #rrggbb → Skia Color 변환 utility (parse_css_color) · CJK fallback chain (맑은 고딕/나눔고딕/AppleGothic → custom_typefaces → font_mgr → legacy) · glyph 크기 bbox 비례 자동 조정 (8~14px) 원본 commits (4건): - 58b839a Task #536 P7: native Skia form control static replay - 2889d9f Copilot 리뷰 반영: RRect import + bg_color 일관 + ComboBox/Edit text-only - a8093f2 CI 수정: Path::new() → PathBuilder (native-skia 호환) - 3b5a027 fix: form control 텍스트 렌더링 CJK fallback 적용 본 환경 자기 정정 (commit `4be49daa`): - impl SkiaLayerRenderer (line 793) 닫힘 brace 누락 발견 — CI Build & Test job 75178101688 (native-skia tests) 동일 결함 발생 - 4번째 commit 85c05bc (CJK fallback) 에서 standalone fn → method 변환 시 impl 닫힘 brace 누락 - 자기 정정 1줄 추가 (line 1025) 자기 검증: - cherry-pick 충돌 0건 (auto-merge 정합) - cargo build --release --features native-skia ✅ 통과 (자기 정정 후) - cargo test --release --features native-skia --lib skia ✅ 24/24 PASS - rhwp export-png samples/form-01.hwp ✅ form-01.png 13353 bytes 생성 - 작업지시자 SVG 시각 판정 ✅ 통과 PR supersede 체인: - PR #599 (P4) → PR #626 (P5) → PR #720 (P6) → PR #740 (P7) — Issue #536 단계적 진전 - 동일 컨트리뷰터 @oksure (PR #599/#626/#720 영역 영역 P4-P6) → @oksure (P7) 영역 영역 정합 Part of #536
This was referenced May 10, 2026
edwardkim
added a commit
that referenced
this pull request
May 10, 2026
P9 단계 — native Skia text replay 영역 기존 TextRunNode payload 영역 더 많이 소비. 단순 glyph drawing 영역 layer payload 의 text metadata 영역 가능 범위 영역 replay. Skia native raster 트래킹 (Issue #536) 의 단계적 진전: - P4 #599 → P5 #626 → P6 #720 → P8 #761 → P9 #769 P9 본질 보강: - char overlap / tab leader / text decoration (underline/strike/overline) - shade/shadow/outline-style effect - emphasis dot (한글 강조점) - vertical rotation (세로쓰기) - output options 영역 control mark replay 인프라 도입 — text_replay.rs 모듈 분리 (P10 → P9 통합): - src/renderer/skia/text_replay.rs 신규 (+748) - renderer.rs 영역 page/layer replay orchestration 영역 집중 - src/renderer/skia/mod.rs 모듈 등록 본 환경 cherry-pick: - 49b540a (P8) → empty (PR #761 머지 완료 영역 동일 본질) → skip - 8f079b1 (P9 본질 1) → cherry-pick - c74fb92 (P9 본질 2, split) → cherry-pick Non-goals (PR 본문 명시): - full text source table / glyph-run IR 미포함 - Skia 영역 기본 public render path 전환 부재 - targeted raster test 외 visual/pixel regression infrastructure 추가 부재 검증: - cargo build/test/clippy --release ALL GREEN - cargo test --features native-skia --lib skia → 28/28 PASS (신규 4건 + 기존 24건) - renders_char_overlap_text_run_as_ink - renders_decorated_text_as_ink - renders_tab_leader_for_empty_text_run - renders_output_control_marks_as_ink - cargo clippy --release --features native-skia --lib -- -D warnings 통과 - 광범위 sweep 7 fixture / 170 페이지 / 회귀 0 (skia 만 영역 svg sweep 무영향 입증) - 시각 판정 면제 (작업지시자 결정 — targeted raster + sweep 통과 + Skia 만 변경) Refs #536
edwardkim
added a commit
that referenced
this pull request
May 11, 2026
…ract (P11) P11 단계 — P9 영역 영역 text replay parity 후속 영역 영역 Text IR v2 compatibility contract 추가. Skia native raster Issue #536 트래킹 단계적 진전: P4 #599 → P5 #626 → P6 #720 → P8 #761 → P9 #769 → P11 #797 중요: 본 PR 은 GlyphRun 을 기본 경로로 만드는 PR 이 아니라 TextRun v2 compatibility contract 를 완성하는 PR. 4 본질 원칙: - Compatibility first — 모든 backend 가 TextRun fallback 으로 렌더링 가능 - Additive schema — schemaMinorVersion + feature negotiation (기존 consumer 미파괴) - Source traceability — text_sources + TextRun.source span - Placement/cluster metadata — paintStyle/projectionKind/orientation/placement/clusterBasis/clusters/legacyVisuals 신규 인프라: - PaintOp::{CharOverlap, TextControlMark, TabLeader, TextDecoration} — explicit visual ops - PageLayerTree.text_sources + TextSourceTable (export-local) - TextRun.source span + 7 신규 metadata - schemaMinorVersion + resourceTableMinorVersion + feature negotiation - docs/text-ir-v2.md migration contract Renderer 정정 — 4 backend 동기 (feedback_image_renderer_paths_separate 권위 사례): - svg_layer.rs / canvas.rs / skia/renderer.rs / web_canvas.rs — 신규 special visual op skip (double-painting 방지) Non-goals (Still designing): - GlyphRun eligibility / font resource table / cluster basis / fallback diagnostics — P12+ 분리 검증: - cargo build/test/clippy --release ALL GREEN (clippy -D warnings) - native-skia 28/28 PASS (PR #769 인프라 보존) - 광범위 sweep 7 fixture / 170 페이지 / 회귀 0 (Compatibility first 원칙 입증) - 시각 판정 면제 (작업지시자 결정 — contract 정합 단계 + 결정적 검증 + sweep 통과) Refs #536
5 tasks
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가 로드되지 않는지 확인합니다.