Skip to content

Fix calculate_content_widths when inline boxes immediately follow a hard/explicit newline - #746

Open
nicoburns wants to merge 3 commits into
linebender:mainfrom
DioxusLabs:devin/1786652166-inline-box-after-newline-content-width
Open

Fix calculate_content_widths when inline boxes immediately follow a hard/explicit newline#746
nicoburns wants to merge 3 commits into
linebender:mainfrom
DioxusLabs:devin/1786652166-inline-box-after-newline-content-width

Conversation

@nicoburns

Copy link
Copy Markdown
Collaborator

LLM Contributions: Bug identified and code generated with Devin Ultra.

Fix calculate_content_widths when an inline boxes immediately follows a hard/explicit newline. They were previously incorrectly counted as being before the newline because the "Mandatory Break" is only set on the character following the line break. This change mirrors what the line-breaking is already doing into the content width calculation.

Changelog

Added

  • Fix calculate_content_widths when an inline boxes immediately follows a hard/explicit newline. They were previously incorrectly counted as being before the newline.

@DJMcNab DJMcNab left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't have enough context to review this. It does look a bit suspect - the whitespace_advance(prev_atom) looks like it might be happening twice?

Comment on lines +123 to +128
///
/// The mandatory break used to be detected via the boundary flag on the text
/// atom *after* the break, so inline boxes between the newline and that atom
/// were attributed to the line *before* the break, under-reporting the max
/// content width. In Blitz this caused inline-block links following a `<br>`
/// to wrap inside a shrink-to-fit container even though they fit on one line.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
///
/// The mandatory break used to be detected via the boundary flag on the text
/// atom *after* the break, so inline boxes between the newline and that atom
/// were attributed to the line *before* the break, under-reporting the max
/// content width. In Blitz this caused inline-block links following a `<br>`
/// to wrap inside a shrink-to-fit container even though they fit on one line.

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.

2 participants