fix(php-transformer): include table-cell box model in layout-table tracks - #2213
Conversation
|
Reviewed and reproduced: the root cause is right (a td's CSS One change before merge: this adds a new padding/border shorthand parser ( Review by Claude (Anthropic) via Claude Code, orchestrated by @chubes4: AI read the diff, checked for existing primitives, and drafted these notes. |
…acks Absolute cell widths are content-box; flex columns are border-box, so the leftover track was 10px too wide after sized columns kept their CSS width. Add UA/authored padding to the column flex-basis, restore UA table-cell padding, and carry separate-border spacing as column-gap plus padding-inline when a row still has an unsized column.
…eset The leftover-track spacing carrier was one class. Engine-support gap:0 is more specific, so column-gap never applied and the unsized column kept the inter-cell 2px.
54c70fc to
0862757
Compare
Problem
After #2211, sized layout-table columns keep their authored CSS width (
flex-basis+flex-grow:0). A fixed-layout post + sidebar row still came out 10px too wide in the leftover (unsized) column.Measured at 1440×900 on a public two-column blog post:
The leftover track was
container − 215, ignoring the table box model. Photos sized to the post column inherited the extra 10px.Root cause
A CSS
widthon atdis content-box. Flex columns are border-box withbox-sizing:border-box. Copying215pxasflex-basismade the sized track 2px too small (UAtdpadding is 1px per side) and dropped UAborder-spacing:2px(engine-support forcesgap:0to beat Gutenberg's 2em).On a 960px
table-layout:fixedrow:Stage: php-transformer layout-table → columns lowering (
layoutTableCellTrackWidth/layoutTableColumnsAttributes/ engine-support CSS). Not capture.Fix
cellpadding) and border widths, converting content-box width to the border-box flex-basis.:where()restores UA table-cellpadding:1pxat zero specificity so authored padding still wins.column-gap+padding-inlineon a carrier whose selector beats thegap:0reset. Collapsed and all-percent rows keepgap:0.CssValueInspector::expandBoxShorthand()→[top, right, bottom, left]. Layout-table track sums andStyleAttributeMapper::boxSides()both use it. Border-width tokens inbordershorthands go throughCssValueInspector::isBorderWidthToken().No product or platform names.
Test
php-transformer/tests/unit/layout-table-column-track-width.phpcontent-box pixel cell width plus ua padding becomes the border-box column track(got215px, want217px) plus HTML width, authored padding, UA padding CSS, and leftover spacing (6 failing assertions).padding:0keeps 215px, authoredpadding:0 4pxbecomes 223px, leftover spacing, collapsed/percent rows do not emit UA gap).php-transformer/tests/unit/css-value-inspector.phpcovers the shared side-expansion helper.composer test,php tests/contract/production-acceptance-matrix.php, and visual-paritynpm testpassed locally.Before / after (Playwright, 1440×900 unless noted)
Post:
/blog/experiencing-the-rural-life-of-100-years-ago//blog/at 1440: post 735, sidebar x=981. 768 and 390 stack (flex-basis:100%), no overflow.Block editor (rural-life post): 97 blocks, all
isValid.AI disclosure
Written by Claude (Anthropic) via Claude Code, orchestrated by chubes4. Claude measured source vs WordPress table geometry (content-box width, UA padding, border-spacing), extended layout-table column lowering to include the cell box model and leftover-row spacing, added a regression test that failed on trunk, ran php-transformer suites, built an SSI dev package from this worktree, imported the kept capture, and measured before/after including Gutenberg
isValid. Review follow-up extractedCssValueInspector::expandBoxShorthand()/isBorderWidthToken()so track sums andStyleAttributeMappershare one side-expansion implementation.