Implement block-step-size (CSS Rhythmic Sizing)

#589684500 #626703 (interop) flag: CSSBlockStepSize Blink>Layout

What

block-step-size rounds a block-level box's outer size up to a multiple of a given step unit, so vertical rhythm survives content changes. A box with a fixed step establishes an independent formatting context; a block-level replaced child centers inside the extra space via its block-axis margins. See CSS Rhythmic Sizing Level 1.

This CL lands the block-step-size longhand behind the CSSBlockStepSize flag. The siblings (block-step-align, block-step-insert, block-step-round) stay at their defaults (auto / margin-box / up) and are not parsed yet.

Before / after

Same demo, same headless_shell build, same window size. Only the runtime flag differs: --disable-blink-features=CSSBlockStepSize vs --enable-blink-features=CSSBlockStepSize. The yellow ruler is a 100px scale with 10px ticks.

before (flag off)ignored
Before: four containers hug their natural content height (51, 0, 60, line-height).
after (flag on)rounded up to 100
After: every container grows to a 100px multiple; the replaced image gets 20px of margin on each side.

Live sampler

Each card renders live in your browser (Rendered) next to the flag-off (Before) and flag-on (After) captures.

height: 51px; block-step-size: 50px
before: 51px block, container height 51
after: block rounded up to 100, container height 100
(empty) block-step-size: 100px
before: empty container collapses to 0
after: empty container grows to one full step (100px)
<img> 60x60 block-level; block-step-size: 100px
before: 60px img, container 60px tall
after: img gets 20/20 block-axis margins; container 100px tall
min-content text; block-step-size: 100px
x x x
before: text-height block, container shorter than 100
after: block rounded up to 100, container 100 tall

Red / green

external/wpt/css/css-rhythm/ under the new virtual suite virtual/css-block-step-size/:

runpassedfailed
before (flag off, same tests on main)2213
after (flag on, this CL)350

The 13 flipped tests are the two parsing files, the seven replaced-elements/block-level-*-margins-affected-by-block-step-size reftests, the computedstyle/block-level-replaced-elements-* test, content-based-height-rounds-up-to-step-unit, definite-height-rounds-up-to-step-unit, definite-height-rounds-up-to-next-multiple-of-step-unit and zero-outer-size-rounded-up-to-block-step-size.

Repro

<!-- flag: --enable-blink-features=CSSBlockStepSize -->
<div style="width:100px;background:green;display:flow-root">
  <img src="60x60-green.png"
       style="display:block;block-step-size:100px">
</div>
/* container renders 100px tall; img gets 20px top + 20px bottom margin */

Full demo: demo.html.

Links

Issue 589684500 · Issue 626703 · CSS Rhythmic Sizing 1 - block-step-size · WPT css/css-rhythm