Skip to content

Fix clamping of negative half-leading in line extents - #9

Open
nicoburns wants to merge 1 commit into
mainfrom
devin/1786407000-stack-1
Open

Fix clamping of negative half-leading in line extents#9
nicoburns wants to merge 1 commit into
mainfrom
devin/1786407000-stack-1

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 11, 2026

Copy link
Copy Markdown
Member

LLM Contributions: This PR (code and description) was authored by Devin, directed and reviewed by @nicoburns.

Bottom PR of the stack (#9#10#7).

When line-height < ascent + descent, half-leading is negative and a line's over/under extents are legitimately negative — but Extents::default() was {over: 0, under: 0}, so max() floored them at zero and lines rendered too tall (e.g. line-height: 0 still produced a full-height line). This fixes the css/CSS2/linebox/line-height-* WPT cluster (Group B in DioxusLabs/blitz#627).

  • Extents::default()f32::NEG_INFINITY (as the old code comment anticipated); finish_line resolves lines with no extent contributions back to Extents::ZERO, keeping builders_empty NaN-free.
  • Half-leading computation factored into a shared text_extents(ascent, descent, line_height, quantize) -> Extents.
  • BreakerState::append_inline_box_to_line(next_x, Option<InlineBoxAlignment>, quantize): None (out-of-flow boxes) contributes nothing — previously their (0.0, 0.0) contribution silently clamped negative extents.
  • finish_line computes and returns the final line height instead of receiving it precomputed.

Changelog

Fixed

  • Line extents are no longer clamped to zero, so negative half-leading (line-height smaller than the font's ascent + descent) now produces correctly-sized line boxes.

Changed

  • [Breaking change:] BreakerState::append_inline_box_to_line now takes an Option<InlineBoxAlignment> and a quantize flag.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/6ab608fbe6fb46479d6dab03fedceb25

Extents now default to f32::NEG_INFINITY so legitimately negative
extents (line-height < ascent + descent) are preserved; lines with no
extent contributions are resolved to zero in finish_line. Out-of-flow
inline boxes no longer contribute (0, 0) extents.
@nicoburns nicoburns self-assigned this Aug 11, 2026
@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

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