[css-text] A leading white-space should break before handling overflow
Leading white-spaces are indeed breaking opportunities that should prevent, if there are no other css properties forcing it, breaking text in the middle of a word when honoring the word-wrap/overflow-wrap CSS property. We are doing so if the leading white-space sequence is longer than 1 character, but when we have a single leading white-space, we are missing that breaking opportunity and we may lead to cases, like the one described in the bug. The root cause of the issue with single leading white-space breaking opportunities is that the RewindToMidWordBreak expects certain width to be committed in order to choose opportunities in previous runs if none of the ones detected by the ICU LazyLineBreakIterator prevents the overflow. However, this breaking opportunity should be considered together with other provided by the word-break CSS property (eg, break-word or break-all), as it was agreed in the discussion [1] with the CSS WG. This CL solves the issue identifying the single leading white-space braking opportunity in a new class field flag, and using it to consider this opportunity inside the mid-word breaking logic, or prevent to run it completely in the cases where 'break-all' is not set. This is basically a reland of 6ea2a2e7 but with some changes to avoid regressions like the one reported in issue #866109. [1] https://github.com/w3c/csswg-drafts/issues/2907 Bug: 854624 Change-Id: I1cc0f55050d54ea1e76c655cf6b3ef8bcc0b0e2c Reviewed-on: https://chromium-review.googlesource.com/c/1209745 Commit-Queue: Javier Fernandez <jfernandez@igalia.com> Reviewed-by:Koji Ishii <kojii@chromium.org> Cr-Commit-Position: refs/heads/master@{#596406}
Showing
Please register or sign in to comment