Skip to content

Commit e877bcd

Browse files
authored
[css-text-3] Spaces don't hang when break-spaces is specified (#2612)
[css-text-3] Spaces don't hang when break-spaces is specified Closes #2465
1 parent beb5964 commit e877bcd

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

css-text-3/Overview.bs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -724,17 +724,20 @@ Characters and Letters</h3>
724724
(ignoring any intervening <a>inline box</a> boundaries)
725725
is removed.
726726
<li>If spaces or tabs at the end of a line are non-collapsible
727-
but have 'white-space' set to ''pre-wrap''
728-
the UA must either <a>hang</a> the <a>white space</a>
729-
or visually collapse the character advance widths
730-
of any overflowing spaces
731-
such that they don't take up space in the line.
732-
However, if 'overflow-wrap' is set to ''break-spaces'',
733-
collapsing their advance width is not allowed,
734-
as this would prevent the preserved spaces from wrapping.
735-
736-
Note: Hanging the white space rather than collapsing it
737-
allows users to see the space when selecting or editing text.
727+
but have 'white-space' set to ''pre-wrap'':
728+
<ul>
729+
<li>If 'overflow-wrap' does not specify ''overflow-wrap/break-spaces''
730+
the UA must either <a>hang</a> the <a>white space</a>
731+
or visually collapse the character advance widths
732+
of any overflowing spaces
733+
such that they don't take up space in the line.
734+
735+
Note: Hanging the white space rather than collapsing it
736+
allows users to see the space when selecting or editing text.
737+
<li>Otherwise
738+
(i.e. 'overflow-wrap' property specifies ''overflow-wrap/break-spaces''),
739+
hanging or collapsing the advance width of spaces at the end of the line is not allowed.
740+
738741
</ol>
739742

740743
Issue: Add example of hanging white space + same example right-aligned.
@@ -1241,19 +1244,17 @@ Line Breaking Details</h3>
12411244
No hyphenation character is inserted at the break point.
12421245
<dt><dfn>break-spaces</dfn></dt>
12431246
<dd>Line breaks are handled as usual,
1244-
except that any sequence of <a>preserved</a> white space
1245-
that would otherwise overflow the line and <a>hang</a> as per <a href="#white-space-phase-2">Trimming and Positioning</a>
1246-
must be broken after the last white space character that would fit the line,
1247-
or after the first white space in the sequence if none would fit.
1248-
1249-
<p class="note">This value does not guarantee that there will never be any overflow due to spaces.
1250-
For example, if 'overflow-wrap' is set to ''break-spaces''
1251-
and 'white-space' to ''pre-wrap'',
1252-
and there is a single <a>preserved</a> space at the end of the line,
1253-
and that space overflows,
1254-
the rules of ''break-spaces'' do not introduce any additional line break,
1255-
and that space does overflow and <a>hang</a>.
1256-
Also, if the line length is so short that even a single space does not fit,
1247+
except that:
1248+
* Any sequence of <a>preserved</a> white space always takes up space,
1249+
including at the end of the line.
1250+
* A line breaking opportunity exists after every <a>preserved</a> <a>white space</a> character,
1251+
including between white space characters.
1252+
1253+
As preserved spaces take up space and do not hang,
1254+
they affect the box's intrinsic sizes ([=min-content size=] and [=max-content size=]).
1255+
1256+
<p class="note">This value does not guarantee that there will never be any overflow due to spaces:
1257+
for example, if the line length is so short that even a single space does not fit,
12571258
overflow is unavoidable.</p>
12581259

12591260
</dl>

0 commit comments

Comments
 (0)