Skip to content
Commit b3999fed authored by Javier Fernández García-Boente's avatar Javier Fernández García-Boente Committed by Commit Bot
Browse files

[css-text] Handling trailing ideographic spaces in Legacy layout

In r824597 we have landed the new behavior of the NGLineBreaker class to
deal with trailing ideographic spaces, according to the last changes in
the CSS Text 3 specification.

These spaces are defined in the spec as 'other space separator' [1] and
as such, they should not be considered 'collapsible spaces' [2]. This
fact has some implications in the implementation of the Phase I [3] of
the White Space Processing algorithm.

Additionally, this CL implements also the required logic in the
BreakingContext class to deal with this kind of trailing spaces,
according to the value of the 'white-space' [4] CSS property. When its
allowed, these trailing spaces will be hang or even broken (in case of
break-space value), instead of selecting previous breaking opportunities
to avoid overflow, like it's described in the bug.

It's worth mentioning that even though this CL is about hanging trailing
spaces, we need to apply some changes in the TextBreakIterator. These
changes are needed to avoid ideographic spaces to be handled by ICU. The
problem is that ICU, following the UAX14 spec where ideographic spaces
are classified as BA, will return breaking opportunities 'after' the
trailing spaces character sequence. However, due to some performance
optimizations, we have decided to implement the BreakingContext logic
assuming that we always break before space (kBeforeEverySpace).

We have landed a patch in r807457 with an important refactoring to sync
TextBreakIterator behavior on the white-space handling with ICU, so that
we always break 'before space'. However, this change affects only to the
LayoutNG inline-layout logic, which was adapted accordingly to the new
behavior.

We have decided to avoid this approach for Legacy layout, since a big
refactoring like this could imply important regressions, difficult to
track and fix nowadays. The changes in the TextBreakIterator performed
by this CL try to handle ideographic spaces as if they were regular
white space character, avoiding ICU. The specific hanging behavior will
be implemented then by the BreakingContext class, assuming the old
'break before space' behavior.


[1] https://drafts.csswg.org/css-text-3/#other-space-separators
[2] https://drafts.csswg.org/css-text-3/#collapsible-white-space
[3] https://drafts.csswg.org/css-text-3/#white-space-phase-1
[4] https://drafts.csswg.org/css-text-3/#white-space-property

Bug: 972952
Change-Id: Ibc5a9d4c0b420320ef03f2a088685775b0034ec5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2521614


Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#824903}
parent 6699e788
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment