Skip to content

Fix line breaking with break-spaces in the presence of close tags - #38106

Merged
chromium-wpt-export-bot merged 1 commit into
masterfrom
chromium-export-cl-4150327
Jan 25, 2023
Merged

chromium-wpt-export-bot merged 1 commit into
masterfrom
chromium-export-cl-4150327

Conversation

@chromium-wpt-export-bot

@chromium-wpt-export-bot chromium-wpt-export-bot commented Jan 23, 2023 •

Copy link
Copy Markdown
Collaborator

With the white-space: break-spaces CSS property, white spaces are
always preserved, and they always take space. Combined with the fact
that white space characters have a break opportunity after them, but
not before (as required by UAX#14), this means that a word which
exactly fits the remaining inline size of the line, could not fit in
that line without overflow if it was followed by a space.

Chromium's implementation of break-spaces, however, did allow
breaking between a word and a space if there was a closing element
boundary in the way, even if both sides of the boundary had
white-space: break-spaces. This is because
NGLineBreaker::HandleCloseTag did not seem to be considering the
break-spaces class. This CL fixes this.

Bug: 1261435
Change-Id: I010cf99ffb0c2cf03b4ff2547a412cc44c7e1bab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4150327
Reviewed-by: Koji Ishii <[email protected]>
Commit-Queue: Andreu Botella <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1096617}

@wpt-pr-bot wpt-pr-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The review process for this patch is being conducted in the Chromium project.

With the `white-space: break-spaces` CSS property, white spaces are
always preserved, and they always take space. Combined with the fact
that white space characters have a break opportunity after them, but
not before (as required by UAX#14), this means that a word which
exactly fits the remaining inline size of the line, could not fit in
that line without overflow if it was followed by a space.

Chromium's implementation of `break-spaces`, however, did allow
breaking between a word and a space if there was a closing element
boundary in the way, even if both sides of the boundary had
`white-space: break-spaces`. This is because
`NGLineBreaker::HandleCloseTag` did not seem to be considering the
`break-spaces` class. This CL fixes this.

Bug: 1261435
Change-Id: I010cf99ffb0c2cf03b4ff2547a412cc44c7e1bab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4150327
Reviewed-by: Koji Ishii <[email protected]>
Commit-Queue: Andreu Botella <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1096617}
@chromium-wpt-export-bot
chromium-wpt-export-bot merged commit 59b61bc into master Jan 25, 2023
@chromium-wpt-export-bot
chromium-wpt-export-bot deleted the chromium-export-cl-4150327 branch January 25, 2023 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants