Skip to content

Keep an image's inline box declarations above projected author image rules - #7460

Merged
chubes4 merged 1 commit into
trunkfrom
fix/wave-atlas-aspect-ratio
Nov 23, 2026
Merged

chubes4 merged 1 commit into
trunkfrom
fix/wave-atlas-aspect-ratio

Conversation

@chubes4

@chubes4 chubes4 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #7458.

Why

An unlinked image's inline aspect-ratio beats every normal author rule in the source. After conversion, imageBoxConstraintClassName() restated it as .carrier img (0,1,1). Projection had already rewritten the author rule .wave-atlas-photo{aspect-ratio:1} onto the leaf as .wave-atlas-photo.wp-block-image>img (0,2,1), so the author rule won and the image rendered square. On the Studio Bossa homepage this took 83–176px off the "Find your little Bossa." Bossa Rio card and shifted everything below it.

What changed

StyleResolver::imageBoxConstraintClassName() now splits the box declarations:

  • Inline-origin declarations (source inline, not !important) go under :root plus the carrier class, repeated one more time than the most specific matching normal author rule declaring those properties. When an ID rule competes, the carrier uses an :is(#…) arm. That is one class and one type more than projection adds to an author image rule, and the same normal-tier approach InlineGeometry uses. It needs no !important, so source !important author rules still win.
  • Structural defaults and other non-inline values (width:auto, max-width:none, …) stay on the plain .carrier img rule. Author media rules can still override them, as before.

Output change for the affected markup:

/* before */
.be-inline-geometry-X img{aspect-ratio:0.813559 / 1}                         /* (0,1,1) loses to (0,2,1) */
/* after */
:root .be-inline-geometry-X.be-inline-geometry-X img{aspect-ratio:0.813559 / 1}  /* (0,3,1) */

Parity fixtures are unchanged (368 pass).

Regression test

tests/unit/inline-image-aspect-ratio-outranks-author-class.php compiles an unlinked image with inline aspect-ratio:0.813559 / 1 under an author .photo{aspect-ratio:1}. It asserts that the carrier rule matching the rendered <img> out-specifies the projected author rule. It fails on trunk with inline aspect-ratio carrier (0,1,1) must outrank the projected author rule (0,2,1) and passes here.

End-to-end evidence

A subset copy of the Studio Bossa capture (/, /shop/, /bossa-rio-collection/ plus shared assets) was imported with the trunk-1123 Studio CLI and an SSI dev package (SSI a1154c4e). One package was built against BE trunk 0b8ad4d4, the other against this branch. I then ran data-liberation compare (DLA 0.41.1, --screenshots) against the full capture.

width before (trunk) after (this PR)
390 page height 17217 vs 17297 (Δ-80); 82 text runs moved; 5 images moved; backgrounds 390x479 at (0,12631) and 342x260 at (24,13272) have no painted box page height 17307 vs 17297 (Δ10); 0 text runs moved; 0 images moved; no background geometry findings
768 18025 vs 18191 (Δ-166); 82 text runs moved; 14 images moved; 768x944 at (0,12631) has no painted box 18201 vs 18191 (Δ10); 0 text runs moved; 0 images moved; no background geometry findings
1440 16791 vs 16864 (Δ-73); 82 text runs moved; 12 images moved; 360x443 at (531,12445) has no painted box 16874 vs 16864 (Δ10); 0 text runs moved; 0 images moved; no background geometry findings

Measured Bossa Rio image box (source / before / after):

width source before after
390 390x479 390x390 390x479
768 768x944 768x768 768x944
1440 360x443 360x360 360x443

The remaining Δ10 matches the homepage height before the source added this section (within 10px). The remaining failures are the nav 404s, which come from the subset, and pixel tiles. Those tiles come from the separate dropped inline background-image on atlas <img>s, tracked in #7459.

Checks

  • php tests/unit/inline-image-aspect-ratio-outranks-author-class.php: pass. It fails on trunk.
  • php tests/unit/artifact-image-aspect-ratio.php: pass.
  • php tests/run.php: 2009 tests. Locally, the only failures are three Chrome-dependent contracts that also fail on trunk without Chrome. On PHP 8.5, two more tests fail from SplObjectStorage::contains() deprecations, and both pass on PHP 8.4.
  • php tests/parity/run.php: 368 fixtures pass.
  • composer lint (PHPCS + PHPStan): clean.

AI disclosure: implemented by Claude (Opus) as a Franklin/Pi subagent; Chris Huber directed the work.

@chubes4
chubes4 merged commit 2f5d0b3 into trunk Nov 23, 2026
15 checks passed
@chubes4
chubes4 deleted the fix/wave-atlas-aspect-ratio branch November 23, 2026 23:05
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.

Inline image aspect-ratio loses to a projected author class rule

1 participant