Improve HTML-to-PAGX fidelity and optimize generated PAGX#3596
Merged
Conversation
…html> box before capture.
…apshot eval report.
… capture and clamp capture height to a renderable max.
…ort to the body canvas before capture, matching the baseline.
…eping cross-axis-unfaithful layouts absolute.
…ing them as inline SVG lines instead of downgrading to solid strips.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3596 +/- ##
==========================================
+ Coverage 82.56% 82.75% +0.18%
==========================================
Files 707 707
Lines 91382 92777 +1395
Branches 25871 26188 +317
==========================================
+ Hits 75452 76776 +1324
Misses 10436 10436
- Partials 5494 5565 +71 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…mporter so they surface as PAGX layer customData.
…t by emitting a placeholder image resource instead of dropping the layer, and always serialize the required Image source attribute.
…ng HTML import so color, gradient, image, position, size and repeat survive property filtering instead of being dropped and losing the box fill.
…tomData instead of the layer during HTML import, so image-carried custom data travels with the image resource.
…esolves to a local path by emitting single-quoted url() in html-snapshot, so it no longer prematurely closes the style attribute and breaks the importer's XML parse.
… instead of wrapping every label in a TextBox, and add a general optimizer rule that collapses redundant single-child Layer nesting while preserving composition, animation and databind semantics.
…ce's customData instead of the layer during HTML import, so image-carried custom data travels with the image resource." This reverts commit a87637a.
…e by defaulting the base face to Regular so fontFamily and fontStyle are always present.
…r padded layers during collapse optimization.
…timizer canonicalization and resource pruning.
…orter and optimizer tests.
shlzxjp
reviewed
Jul 20, 2026
shlzxjp
reviewed
Jul 20, 2026
shlzxjp
reviewed
Jul 20, 2026
shlzxjp
reviewed
Jul 20, 2026
shlzxjp
reviewed
Jul 20, 2026
shlzxjp
reviewed
Jul 20, 2026
shlzxjp
reviewed
Jul 20, 2026
shlzxjp
reviewed
Jul 20, 2026
…scape quoted url paths and warn on conflicting data attributes.
OnionsYu
force-pushed
the
feature/onionsyu_import_html3
branch
from
July 20, 2026 08:35
f5a1385 to
ea47ec0
Compare
OnionsYu
force-pushed
the
feature/onionsyu_import_html3
branch
from
July 21, 2026 03:18
eaf45fe to
d3b2f07
Compare
… not captured mid-animation.
Force scroll-behavior:auto on <html>/<body> in prepareBodyForSnapshot, the
autoscroll warm-up, and baseline captureBodyRect so scrollTo(0,0) jumps to the
origin instead of easing. On pages with html{scroll-behavior:smooth} the reset
was animated, so geometry was measured while the page was still scrolled down,
offsetting the whole subset (top:-1542px with a matching blank band at the
bottom of the canvas).
Also share the canvas-viewport resize guard between the subset and the baseline
so both revert together on fluid / viewport-driven pages.
…rate, grayscale, sepia, invert, opacity, hue-rotate) to a ColorMatrixFilter during HTML import, clamping amounts to the browser range.
…e during HTML import, keeping the background-color Fill underneath as the blend backdrop while leaving the bottom-most background layer unblended.
…) into a contour mask during HTML import and honor clipPathUnits=objectBoundingBox, keeping the snapshot and subset filters in sync.
shlzxjp
reviewed
Jul 21, 2026
shlzxjp
reviewed
Jul 21, 2026
shlzxjp
reviewed
Jul 21, 2026
shlzxjp
reviewed
Jul 21, 2026
shlzxjp
reviewed
Jul 21, 2026
…iffer since PAGX applies a single blend mode per background fill.
shlzxjp
approved these changes
Jul 21, 2026
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 提升 HTML → PAGX 转换链路的还原准确性和健壮性,并通过精简冗余图层减小生成的 PAGX 体积。改动覆盖
html-snapshot、HTML 导入器和 PAGX 优化器。主要改动
html-snapshot
<html>/<body>盒模型、画布视口和滚动位置,修复基准图垂直偏移、视口相对定位偏差及scroll-behavior: smooth导致的截取错位。align-self。HTML → PAGX 导入器
<img>的data-*属性保留到图层customData;对于缺失或无效的src,生成占位图片资源而不是丢弃图层。background简写及声明顺序,保留背景颜色、最上层背景图片/渐变、位置、尺寸和重复方式,并让background-color正确绘制在图片下方。background-blend-mode映射到对应 Fill 的混合模式。brightness()、contrast()、saturate()、grayscale()、sepia()、invert()、opacity()和hue-rotate()等 CSS filter 转换为ColorMatrixFilter。polygon()、path()、circle()、ellipse()和inset()等 CSSclip-path基本形状重建为轮廓遮罩,并支持clipPathUnits="objectBoundingBox"。url()破坏 XML 解析的问题,并保证导入的 Text 节点始终包含明确的fontFamily和fontStyle。PAGX 优化
span直接生成 Text,避免额外的 TextBox 包装。测试
html-snapshot测试,覆盖背景图 URL、虚线边框和图片data-*属性。