Skip to content

Respect text-wrap-mode when line breaking around inline boxes - #16

Open
nicoburns wants to merge 1 commit into
mainfrom
devin/1787087720-nowrap-inline-boxes
Open

Respect text-wrap-mode when line breaking around inline boxes#16
nicoburns wants to merge 1 commit into
mainfrom
devin/1787087720-nowrap-inline-boxes

Conversation

@nicoburns

Copy link
Copy Markdown
Member

LLM Contributions: This PR was written by Devin (analysis, code, and description).

Fixes 10 WPT css-flexbox reftests in Blitz (flexbox_flex-{0,1,N}-0-{N,Npercent,auto}-shrink.html and flexbox_flex-basis.html) whose reference pages use white-space: nowrap on a block containing only adjacent inline-block spans. Parley wrapped the boxes anyway.

Two problems:

  1. The line breaker unconditionally marks a break opportunity after every inline box, ignoring TextWrapMode::NoWrap.
  2. The breaker's wrap-mode state (LineState::text_wrap_mode) is only updated lazily from text clusters, so in a layout containing only inline boxes and no text it stays at the default Wrap and the container's nowrap never takes effect.

Fix:

  • Add LayoutData::default_text_wrap_mode, set from the first resolved style in build_into_layout and overridden by TreeBuilder::build_into with the tree root style's wrap mode (with no text, the style table only contains a synthesized default style, so the root style must be taken from the tree builder).
  • Initialize BreakerState.line.text_wrap_mode from it in BreakLines::new, and only mark a break opportunity after an inline box when the current wrap mode is Wrap.
  • Use the same initialization in calculate_content_widths, so the min-content width of nowrap box-only content is the sum of box widths rather than the max.

Verified against Blitz's WPT runner (same change applied to parley 0.10 via a Cargo patch override): css/css-flexbox pass count goes 654 → 664 with zero regressions.

Changelog

Fixed

  • Inline boxes no longer create line break opportunities when text-wrap-mode is nowrap.

Link to Devin session: https://app.devin.ai/sessions/844c19c6f8394d5bbb88b577c1f0558e
Requested by: @nicoburns

@nicoburns nicoburns self-assigned this Aug 18, 2026
@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