Skip to content

fix(php-transformer): preserve inherited border-box resets - #1658

Merged
chubes4 merged 2 commits into
trunkfrom
fix/studio-4756-browser-fidelity
Sep 10, 2026
Merged

fix(php-transformer): preserve inherited border-box resets#1658
chubes4 merged 2 commits into
trunkfrom
fix/studio-4756-browser-fidelity

Conversation

@chubes4

@chubes4 chubes4 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserves the common html{box-sizing:border-box} *,*::before,*::after{box-sizing:inherit} reset when projecting CSS into native WordPress blocks, and retains linked SVG-only logos as materialized image blocks.

Border-Box Root

  • php-transformer/src/HtmlToBlocks/Style/AuthorStyleRuleProjector.php:authorStylesUseUniversalBorderBoxReset()
  • The prior detector recognized only explicit *{box-sizing:border-box}, then injected box-sizing:content-box on generated Groups despite an inherited root reset.

Linked SVG-Only Logo Root

  • HtmlCompilation::isLinkedSvgLogoAnchor() previously required the wrapper anchor itself to carry a logo/brand token. An unlabelled link around a descendant .logo containing only inline SVG returned null before its child could be converted, omitting the header artwork.
  • LogoPattern also rejected SVG-only logo content because its text content was empty.
  • The fix recognizes a descendant logo signal, materializes the safe SVG asset, and makes a percentage-width linked core/image resolve against its sized figure rather than its shrink-to-fit link wrapper.
  • Existing upstream linked-SVG logo work was reviewed (#525); this closes the remaining wrapper-signal case rather than duplicating it.

Public Reproducer

  • php-transformer/tests/unit/artifact-author-stylesheet-projection.php covers a root + universal inherited border-box reset with a width-and-padding Group.
  • php-transformer/tests/unit/author-selector-semantics.php covers an unlabelled link wrapping a descendant .brand-logo with a width="100%" height="100%" inline SVG.

Verification

  • php tests/contract/run.php
  • php tests/unit/author-selector-semantics.php
  • php tests/unit/artifact-author-stylesheet-projection.php
  • php tests/unit/engine-support-css-specificity.php
  • php -l src/HtmlToBlocks/HtmlCompilation.php
  • php -l src/HtmlToBlocks/Patterns/LogoPattern.php
  • php -l src/HtmlToBlocks/Support/SvgMaterializer.php
  • Real supported static-site-importer import candidate browser proof at 1440x900 and 390x844: header SVG now materializes and loads 200 at 227.7x30; footer SVG asset also loads 200 at 227.7x30. Candidate document widths are exactly 1440 and 390, confirming no horizontal overflow after the inherited border-box fix. The footer is at x=-114 on mobile in both source and candidate, so that clipping is source-authored, not a transformation regression.

AI assistance: openai/gpt-5.6-terra via OpenCode was used to diagnose browser DOM/CSS behavior and implement the fix.

@chubes4
chubes4 merged commit a950cfd into trunk Sep 10, 2026
10 checks passed
@chubes4
chubes4 deleted the fix/studio-4756-browser-fidelity branch September 10, 2026 18:53
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.

1 participant