Skip to content

Materialize SVG artwork that carries rendering hints - #1565

Merged
chubes4 merged 1 commit into
trunkfrom
fix/1243-svg-rendering-hint-materialization
Sep 4, 2026
Merged

Materialize SVG artwork that carries rendering hints#1565
chubes4 merged 1 commit into
trunkfrom
fix/1243-svg-rendering-hint-materialization

Conversation

@chubes4

@chubes4 chubes4 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #1243.

Problem

SVG rendering hints — shape-rendering, text-rendering, image-rendering, color-rendering, color-interpolation, paint-order — were missing from the passive-attribute allowlist in SvgMaterializer::isPassiveSvgMarkup().

These are presentation-only attributes. They tune rasterization quality and carry no scripting, no external references, and no document dependency. But because they were unlisted, isPassiveSvgElement() rejected the element, isNativeImageCompatibleSvg() returned false, and otherwise-passive artwork fell through to the "honest floor" at the end of inlineSvgBlockFromElement() and was preserved as a core/html island.

One unlisted presentation attribute was enough to disqualify an entire graphic from the native image path.

Fix

Add the six rendering-hint attributes to $allowedAttributes. Nothing else changes: the safety gates for script, event handlers, javascript: URLs, external href, currentColor, var() and page-CSS-animated descendants are untouched.

Measured

Imported https://www.biajmsb.ca/ (Wix, 14 routes) through Studio → Data Liberation → Static Site Importer → Blocks Engine.

The site logo carries shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" and appears twice per page (desktop + mobile responsive variants), so it produced two core/html islands on every route.

before after
core_html_blocks 28 0
failure_reasons unsupported_html_fallback, core_html_block unsupported_html_fallback

core_html_block is no longer a failure reason for this site. The two remaining unsupported_fallbacks are the contact form and are unrelated to this change.

Isolated reproduction of the same logo markup:

before: core/group + core/html
after:  core/image

Tests

tests/unit/filtered-svg-materialization.php gains two assertions covering artwork that sets all six hints: it must materialize as core/image with no core/html, and the hints must survive into the materialized SVG asset so rasterization intent is preserved.

Both assertions fail on trunk and pass with this change.

Verification

  • filtered-svg-materialization — 16 passed
  • svg-element-converter — 13 passed
  • svg-materialized-paint-cascade — 20 passed
  • core-html-fallback-reduction — 9 assertions
  • rich-text-svg-transaction — passed
  • composer test:canonical — no failures
  • composer test:parity — 297 fixtures passed

Out of scope

The materialized logo now emits as core/image but still resolves to 0×0 in the header, so it remains visually absent on this site. That geometry collapse is a separate defect on the image-carrier sizing path and is not addressed here; this PR is scoped to the fallback classification only.

AI assistance

Investigated, root-caused, implemented, tested and verified end to end by Claude Sonnet 4.5 running in Claude Code, including the before/after re-import measurement. Chris Huber directed the work and is responsible for the submitted change.

SVG rendering hints (shape-rendering, text-rendering, image-rendering,
color-rendering, color-interpolation, paint-order) are presentation-only:
they tune rasterization and carry no scripting or external reference. They
were missing from the passive-attribute allowlist, so any artwork setting
one was disqualified from the native image path and preserved as a
core/html island instead.

Add them to the allowlist so such artwork materializes as an editable
core/image backed by a portable SVG asset.
@chubes4
chubes4 merged commit d4ae745 into trunk Sep 4, 2026
10 checks passed
@chubes4
chubes4 deleted the fix/1243-svg-rendering-hint-materialization branch September 4, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert Wix tint SVGs natively instead of core/html fallback

1 participant