Skip to content

Commit 521a59b

Browse files
frivoalfantasai
authored andcommitted
[css-text-3] Move break-spaces from overflow-wrap to white-space
Closes #2465
1 parent 09c74f3 commit 521a59b

File tree

1 file changed

+35
-23
lines changed

1 file changed

+35
-23
lines changed

css-text-3/Overview.bs

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ Characters and Letters</h3>
418418

419419
<pre class="propdef">
420420
Name: white-space
421-
Value: normal | pre | nowrap | pre-wrap | pre-line
421+
Value: normal | pre | nowrap | pre-wrap | break-spaces | pre-line
422422
Initial: normal
423423
Applies to: <a>inline boxes</a>
424424
Inherited: yes
@@ -456,6 +456,20 @@ Characters and Letters</h3>
456456
<dt><dfn>pre-wrap</dfn></dt>
457457
<dd>Like ''pre'', this value preserves <a>white space</a>;
458458
but like ''white-space/normal'', it allows wrapping.
459+
<dt><dfn>break-spaces</dfn></dt>
460+
<dd>The behavior is identical to that of ''white-space/pre-wrap'',
461+
except that:
462+
* Any sequence of <a>preserved</a> white space always takes up space,
463+
including at the end of the line.
464+
* A line breaking opportunity exists after every <a>preserved</a> <a>white space</a> character,
465+
including between white space characters.
466+
467+
As preserved spaces take up space and do not hang,
468+
they affect the box's intrinsic sizes ([=min-content size=] and [=max-content size=]).
469+
470+
<p class="note">This value does not guarantee that there will never be any overflow due to spaces:
471+
for example, if the line length is so short that even a single space does not fit,
472+
overflow is unavoidable.</p>
459473
<dt><dfn>pre-line</dfn></dt>
460474
<dd>Like ''white-space/normal'', this value collapses consecutive spaces and allows wrapping,
461475
but preserves <a>segment breaks</a> in the source as <a>forced line breaks</a>.
@@ -473,6 +487,7 @@ Characters and Letters</h3>
473487
<th>New Lines</th>
474488
<th>Spaces and Tabs</th>
475489
<th>Text Wrapping</th>
490+
<th>End-of-line spaces</th>
476491
</tr>
477492
</thead>
478493
<tbody>
@@ -481,30 +496,42 @@ Characters and Letters</h3>
481496
<td>Collapse</td>
482497
<td>Collapse</td>
483498
<td>Wrap</td>
499+
<td>Remove</td>
484500
</tr>
485501
<tr>
486502
<th>''pre''</th>
487503
<td>Preserve</td>
488504
<td>Preserve</td>
489505
<td>No wrap</td>
506+
<td>Preserve</td>
490507
</tr>
491508
<tr>
492509
<th>''nowrap''</th>
493510
<td>Collapse</td>
494511
<td>Collapse</td>
495512
<td>No wrap</td>
513+
<td>Remove</td>
496514
</tr>
497515
<tr>
498516
<th>''pre-wrap''</th>
499517
<td>Preserve</td>
500518
<td>Preserve</td>
501519
<td>Wrap</td>
520+
<td>Collapse or hang</td>
521+
</tr>
522+
<tr>
523+
<th>''break-spaces''</th>
524+
<td>Preserve</td>
525+
<td>Preserve</td>
526+
<td>Wrap</td>
527+
<td>Wrap</td>
502528
</tr>
503529
<tr>
504530
<th>''pre-line''</th>
505531
<td>Preserve</td>
506532
<td>Collapse</td>
507533
<td>Wrap</td>
534+
<td>Remove</td>
508535
</tbody>
509536
</table>
510537

@@ -623,7 +650,7 @@ Characters and Letters</h3>
623650
invisible, but retains its <a>soft wrap opportunity</a>, if any.)</li>
624651
</ol>
625652
</li>
626-
<li><p>If 'white-space' is set to ''pre'' or ''pre-wrap'',
653+
<li><p>If 'white-space' is set to ''pre'', ''pre-wrap'', or ''break-spaces''
627654
any sequence of spaces is treated as a sequence of non-breaking spaces.
628655
However, a <a>soft wrap opportunity</a> exists at the end of the sequence.
629656

@@ -669,7 +696,7 @@ Characters and Letters</h3>
669696
<h4 id="line-break-transform">
670697
Segment Break Transformation Rules</h4>
671698

672-
<p>When 'white-space' is ''pre'', ''pre-wrap'', or ''pre-line'',
699+
<p>When 'white-space' is ''pre'', ''pre-wrap'', ''break-spaces'', or ''pre-line'',
673700
<a>segment breaks</a> are not <a>collapsible</a>
674701
and are instead transformed into a preserved line feed (U+000A).
675702

@@ -730,19 +757,18 @@ Characters and Letters</h3>
730757
(ignoring any intervening <a>inline box</a> boundaries)
731758
is removed.
732759
<li>If spaces or tabs at the end of a line are non-collapsible
733-
but have 'white-space' set to ''pre-wrap'':
734-
<ul>
735-
<li>If 'overflow-wrap' does not specify ''overflow-wrap/break-spaces''
760+
<ul>
761+
<li>If 'white-space' is set to ''pre-wrap'',
736762
the UA must either <a>hang</a> the <a>white space</a>
737763
or visually collapse the character advance widths
738764
of any overflowing spaces
739765
such that they don't take up space in the line.
740766

741767
Note: Hanging the white space rather than collapsing it
742768
allows users to see the space when selecting or editing text.
743-
<li>Otherwise
744-
(i.e. 'overflow-wrap' property specifies ''overflow-wrap/break-spaces''),
769+
<li>If 'white-space' is set to ''break-spaces'',
745770
hanging or collapsing the advance width of spaces at the end of the line is not allowed.
771+
</ul>
746772

747773
</ol>
748774

@@ -1215,7 +1241,7 @@ Line Breaking Details</h3>
12151241

12161242
<pre class="propdef">
12171243
Name: overflow-wrap, word-wrap
1218-
Value: normal | break-word || break-spaces
1244+
Value: normal | break-word
12191245
Initial: normal
12201246
Applies to: <a>inline boxes</a>
12211247
Inherited: yes
@@ -1247,20 +1273,6 @@ Line Breaking Details</h3>
12471273
Shaping characters are still shaped as if the word were not
12481274
broken, and grapheme clusters must stay together as one unit.
12491275
No hyphenation character is inserted at the break point.
1250-
<dt><dfn>break-spaces</dfn></dt>
1251-
<dd>Line breaks are handled as usual,
1252-
except that:
1253-
* Any sequence of <a>preserved</a> white space always takes up space,
1254-
including at the end of the line.
1255-
* A line breaking opportunity exists after every <a>preserved</a> <a>white space</a> character,
1256-
including between white space characters.
1257-
1258-
As preserved spaces take up space and do not hang,
1259-
they affect the box's intrinsic sizes ([=min-content size=] and [=max-content size=]).
1260-
1261-
<p class="note">This value does not guarantee that there will never be any overflow due to spaces:
1262-
for example, if the line length is so short that even a single space does not fit,
1263-
overflow is unavoidable.</p>
12641276

12651277
</dl>
12661278

0 commit comments

Comments
 (0)