Repository navigation
Keep an image's inline box declarations above projected author image rules - #7460
Merged
Merged
Conversation
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.
Fixes #7458.
Why
An unlinked image's inline
aspect-ratiobeats 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:!important) go under:rootplus 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 approachInlineGeometryuses. It needs no!important, so source!importantauthor rules still win.width:auto,max-width:none, …) stay on the plain.carrier imgrule. Author media rules can still override them, as before.Output change for the affected markup:
Parity fixtures are unchanged (368 pass).
Regression test
tests/unit/inline-image-aspect-ratio-outranks-author-class.phpcompiles an unlinked image with inlineaspect-ratio:0.813559 / 1under 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 withinline 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 (SSIa1154c4e). One package was built against BE trunk0b8ad4d4, the other against this branch. I then randata-liberation compare(DLA 0.41.1,--screenshots) against the full capture.390x479 at (0,12631)and342x260 at (24,13272)have no painted box768x944 at (0,12631)has no painted box360x443 at (531,12445)has no painted boxMeasured Bossa Rio image box (source / before / after):
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-imageon 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 fromSplObjectStorage::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.