Fix max-content width of inline boxes following a mandatory break - #12
Open
nicoburns wants to merge 7 commits into
Open
Fix max-content width of inline boxes following a mandatory break#12nicoburns wants to merge 7 commits into
nicoburns wants to merge 7 commits into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Adds long-single-line benchmarks to measure cases where performance is `O(line length)` These have been used to test linebender#762 **LLM Contributions**: Generated with Fable 5.1 Low **Changelog**: None
<!-- Please ensure that you have reviewed our LLM ("AI") policy at
https://linebender.org/wiki/llm-policy/.
If you did not use any LLM tools, please replace `Unspecified` with
`None`. -->
LLM Contributions: Mostly generated.
Follow-up to
linebender#738 (comment).
This is also what Gecko and Blink do (with whitespace collapsing off).
Compare:
https://developer.mozilla.org/en-US/play?id=gilITaZ%2B0hCJVuNWyCoME9xqzkpiKGs0u2alPNKuvKXYzUEm2XX1efjm7j5qJPFZdiEZU%2FYl7eSQxZlN.
<!--
If our users need to know about this change, please describe that in the
quote block below.
What you write here will be edited by us later - it doesn't need to be
perfect.
If this change doesn't need a changelog entry, please replace the next
line with `**Changelog: None**`.
-->
**Changelog: None**
Signed-off-by: Nico Burns <nico@nicoburns.com>
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
nicoburns
force-pushed
the
devin/1786652166-inline-box-after-newline-content-width
branch
from
September 3, 2026 13:20
b2e94d9 to
9f725ed
Compare
Signed-off-by: Nico Burns <nico@nicoburns.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LLM Contributions: This PR (code, test, and description) was produced by Devin, an AI agent, at nicoburns' request.
calculate_content_widthsdetected a mandatory line break via theBoundary::Mandatoryflag on the text atom after the break. Any inline boxes located between the newline character and that atom had already been accumulated intorunning_max_widthby then, so their widths were attributed to the line before the break — under-reporting the max-content width of the line they actually end up on.This is the root cause of DioxusLabs/blitz#705: inline-block links following a
<br>wrapped inside a shrink-to-fit container on https://freyaui.dev even though they fit on one line (Blitz sized the container from parley's under-reported max-content width).The fix mirrors the line breaker's behavior directly in
calculate_content_widths: when an atom is aWhitespace::Newline, the current line is finalized immediately (for both min- and max-content accumulators) and the newline contributes no advance — matchingbreak_all_lines, where a newline ends the line right after itself and everything following it (including inline boxes) belongs to the next line. TheBoundary::Mandatoryflag on the following atom now only acts as a soft break opportunity for the min-content width.Includes a regression test (
inline_boxes_after_newline_max_content_width) with a newline followed by three inline boxes; it fails onmain(layout broken at the reported max-content width comes out wider than that width, i.e. boxes wrap) and passes with this change.Changelog
Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/5da2da1c45d24bd89a90d920fd698681
Requested by: @nicoburns