Skip to content

Block: clamp and synthesize scroll-container baselines - #1126

Merged
nicoburns merged 2 commits into
mainfrom
devin/1787096047-block-scroll-container-baseline
Aug 19, 2026
Merged

Block: clamp and synthesize scroll-container baselines#1126
nicoburns merged 2 commits into
mainfrom
devin/1787096047-block-scroll-container-baseline

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Objective

Give block layout the same scroll-container baseline treatment as flexbox/grid, per the CSSWG resolution in w3c/csswg-drafts#7660: a scroll container's baseline is determined from its content as if scrolled to the initial position but clamped to its border box, and when it has no natural baseline, one is synthesized at its border-box bottom edge.

In perform_final_layout_on_in_flow_children, for each in-flow child that is a scroll container (overflow.y.is_scroll_container()):

let child_baseline = if item.overflow.y.is_scroll_container() {
    Some(item_layout.baselines.first.unwrap_or(item_layout.size.height).min(item_layout.size.height).max(0.0))
} else {
    item_layout.baselines.first // unchanged: no baseline => contributes nothing
};
first_baseline = child_baseline.map(|baseline| location.y + baseline);

Fixes WPT css/CSS2/linebox/baseline-block-with-overflow-001.html in Blitz: previously (a) the baseline of clipped text inside a block overflow: hidden child leaked out and the outer inline-block aligned to it, and (b) an empty overflow: hidden child contributed no baseline where browsers synthesize one at its bottom border edge.

Context

  • Mirrors the existing flexbox logic (clamp_to_border_box / .unwrap_or(size.height) in src/compute/flexbox.rs) and grid behaviour.
  • Tests:
    • Generated fixture test_fixtures/blockflex/blockflex_baseline_overflow_hidden_clamp.html covers the clamping case (a block scroll-container child with taller content, baseline-aligned in a flex container).
    • Hand-written tests in tests/hand_written/baseline.rs cover baseline synthesis for a scroll-container child with no natural baseline, clamping, and that a non-scroll-container child without a baseline still contributes nothing. Chrome does not propagate the synthesized empty-scroll-container baseline in flexbox first-baseline contexts (it does in inline-block contexts, which taffy doesn't model), so the synthesis case cannot be expressed as a gentest.
  • CHANGELOG.md updated under "Fixed".

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/e9fbc6900f2c469d84ca90d71a628d7b
Requested by: @nicoburns

@staging-devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@nicoburns
nicoburns enabled auto-merge (squash) August 18, 2026 23:59
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1787096047-block-scroll-container-baseline branch from 654454f to e84ffd0 Compare August 19, 2026 00:00
@nicoburns
nicoburns merged commit 02820e5 into main Aug 19, 2026
28 checks passed
@nicoburns
nicoburns deleted the devin/1787096047-block-scroll-container-baseline branch August 19, 2026 00:02
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