Skip to content

Add opt-in line-box strut support - #10

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

Add opt-in line-box strut support#10
nicoburns wants to merge 1 commit into
mainfrom
devin/1786407000-stack-2

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.

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

Adds the CSS 2 § 10.8 "strut": without it, a line whose only content is an inline box (e.g. an <img>) got no baseline metrics from the block's font/line-height and rendered too short (Group C1 in DioxusLabs/blitz#627).

  • Builders gain opt-in set_compute_strut(true); build_into_layout then computes StrutMetrics { ascent, descent, line_height } from the resolved root style and stores them as LayoutData::strut.
  • The strut font is the "first available font": the first font in the family stack whose cmap covers U+0020, falling back to the first matched font (https://drafts.csswg.org/css-fonts/#first-available-font). Also fixes first-available-font-003/004.
  • finish_line merges the strut's text_extents into every line that have_metrics (has in-flow content); genuinely empty, whitespace-only, or out-of-flow-only lines intentionally get no strut, matching CSS's zero-height treatment of line boxes without inline-level content.
  • FontMetrics::from_font / FontMetrics::font_covers_char live in parley_engine because skrifa is optional in parley itself; LayoutContext keeps the resolved root_style so the strut can be computed at build time.

Changelog

Added

  • Opt-in line-box strut support: set_compute_strut(true) on the builders sizes every line as if it began with a zero-width glyph in the root style (CSS 2 § 10.8), including lines that contain no text.

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

@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

staging-devin-ai-integration Bot pushed a commit to DioxusLabs/blitz that referenced this pull request Aug 18, 2026
…tive-leading fixes

- Inline-block uses its last in-flow line box baseline, but inline
  flex/grid containers use their first baseline per css-align.
- Bump parley to DioxusLabs/parley#10 which fixes clamping of negative
  half-leading in line extents and adds opt-in CSS2 \u00a7 10.8 line-box strut
  support; enable the strut in Blitz's inline layout.
- With an explicit baseline, an inline box's line-height contribution may
  legitimately be negative, so only clamp reserved space for bottom-aligned
  boxes, and position baseline-aligned boxes from the top of their margin
  box.
staging-devin-ai-integration Bot pushed a commit to DioxusLabs/blitz that referenced this pull request Aug 19, 2026
…tive-leading fixes

- Inline-block uses its last in-flow line box baseline, but inline
  flex/grid containers use their first baseline per css-align.
- Bump parley to DioxusLabs/parley#10 which fixes clamping of negative
  half-leading in line extents and adds opt-in CSS2 \u00a7 10.8 line-box strut
  support; enable the strut in Blitz's inline layout.
- With an explicit baseline, an inline box's line-height contribution may
  legitimately be negative, so only clamp reserved space for bottom-aligned
  boxes, and position baseline-aligned boxes from the top of their margin
  box.
staging-devin-ai-integration Bot pushed a commit to DioxusLabs/blitz that referenced this pull request Aug 19, 2026
…tive-leading fixes

- Inline-block uses its last in-flow line box baseline, but inline
  flex/grid containers use their first baseline per css-align.
- Bump parley to DioxusLabs/parley#10 which fixes clamping of negative
  half-leading in line extents and adds opt-in CSS2 \u00a7 10.8 line-box strut
  support; enable the strut in Blitz's inline layout.
- With an explicit baseline, an inline box's line-height contribution may
  legitimately be negative, so only clamp reserved space for bottom-aligned
  boxes, and position baseline-aligned boxes from the top of their margin
  box.
staging-devin-ai-integration Bot pushed a commit to DioxusLabs/blitz that referenced this pull request Aug 21, 2026
…tive-leading fixes

- Inline-block uses its last in-flow line box baseline, but inline
  flex/grid containers use their first baseline per css-align.
- Bump parley to DioxusLabs/parley#10 which fixes clamping of negative
  half-leading in line extents and adds opt-in CSS2 \u00a7 10.8 line-box strut
  support; enable the strut in Blitz's inline layout.
- With an explicit baseline, an inline box's line-height contribution may
  legitimately be negative, so only clamp reserved space for bottom-aligned
  boxes, and position baseline-aligned boxes from the top of their margin
  box.
Builders gain set_compute_strut(true), which computes CSS 2 \u00a7 10.8
strut metrics from the root style's first available font and
line-height, and merges them into every line that has in-flow content.
@staging-devin-ai-integration
staging-devin-ai-integration Bot changed the base branch from devin/1786407000-stack-1 to main September 1, 2026 20:11
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