Skip to content

Commit cdbe13c

Browse files
committed
[css-text] Add pre-wrap-auto
1 parent 5f3dc4b commit cdbe13c

2 files changed

Lines changed: 86 additions & 5 deletions

File tree

css-text/Overview.bs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ At Risk: the <length> values of the 'tab-size' property
2020
At Risk: the 'text-justify' property
2121
At Risk: the percentage values of 'word-spacing'
2222
At Risk: the 'hanging-punctuation' property
23+
At Risk: the ''pre-wrap-auto'' value of the 'white-space' property
2324
</pre>
2425

2526
<style type="text/css">
@@ -422,7 +423,7 @@ Languages and Typesetting</h4>
422423
</tr>
423424
<tr>
424425
<th><a href="#values">Value</a>:
425-
<td>normal | pre | nowrap | pre-wrap | pre-line</td>
426+
<td>normal | pre | nowrap | pre-wrap | pre-wrap-auto | pre-line</td>
426427
</tr>
427428
<tr>
428429
<th>Initial:</th>
@@ -486,11 +487,24 @@ Languages and Typesetting</h4>
486487
<dt><dfn>pre-wrap</dfn></dt>
487488
<dd>Like ''pre'', this value preserves <a>white space</a>;
488489
but like ''white-space/normal'', it allows wrapping.
490+
<dt><dfn>pre-wrap-auto</dfn></dt>
491+
<dd>Like ''pre-wrap'', this value preserves <i>white space</i> and allows wrapping.
492+
However, some of the behavior is made UA dependent
493+
(See <a href="#white-space-rules">The White Space Processing Rules</a>
494+
for details).
495+
This flexibility allows UAs to match platform conventions,
496+
in particular with respect to multi-line editable text fields,
497+
and when preserved <a>white space</a> at the end a line
498+
would cause the line to overflow.
489499
<dt><dfn>pre-line</dfn></dt>
490500
<dd>Like ''white-space/normal'', this value collapses consecutive spaces and allows wrapping,
491501
but preserves <a>segment breaks</a> in the source as <a>forced line breaks</a>.
492502
</dl>
493503

504+
Issue: Suggestions of a better name for ''pre-wrap-auto'' are welcome.
505+
506+
Note: ''pre-wrap-auto'' is at risk.
507+
494508
<p>The following informative table summarizes the behavior of various
495509
'white-space' values:</p>
496510

@@ -530,6 +544,12 @@ Languages and Typesetting</h4>
530544
<td>Preserve</td>
531545
<td>Wrap</td>
532546
</tr>
547+
<tr>
548+
<th>''pre-wrap-auto''</th>
549+
<td>Preserve</td>
550+
<td>Preserve</td>
551+
<td>Wrap</td>
552+
</tr>
533553
<tr>
534554
<th>''pre-line''</th>
535555
<td>Preserve</td>
@@ -655,6 +675,13 @@ Languages and Typesetting</h4>
655675
between each of the spaces of this preserved sequence,
656676
as well as at the beginning
657677
and at the end of the sequence.</p></li>
678+
<li><p>If 'white-space' is set to ''pre-wrap-auto'',
679+
any sequence of spaces is preserved.
680+
This is achieved by treating it as a sequence of non-breaking spaces.
681+
However, unlike with ''pre-wrap'',
682+
whether <a>soft wrap opportunities</a> exist in this sequence
683+
is user-agent defined.
684+
These UA-specific rules may be context dependent.</p></li>
658685
</ul>
659686

660687
<p>Then, the entire block is rendered. Inlines are laid out, taking bidi
@@ -699,7 +726,7 @@ Languages and Typesetting</h4>
699726
<h4 id="line-break-transform">
700727
Segment Break Transformation Rules</h4>
701728

702-
<p>When 'white-space' is ''pre'', ''pre-wrap'', or ''pre-line'',
729+
<p>When 'white-space' is ''pre'', ''pre-wrap'', ''pre-wrap-auto'', or ''pre-line'',
703730
<a>segment breaks</a> are not <a>collapsible</a>
704731
and are instead transformed into a preserved line feed (U+000A).
705732

@@ -739,6 +766,9 @@ Languages and Typesetting</h4>
739766
from the block's starting content edge.
740767
The tab size is given by the 'tab-size' property.
741768
<li>A sequence of <a>collapsible</a> spaces at the end of a line is removed.
769+
<li>If spaces or tabs at the end of a line are non-collapsible but
770+
have 'white-space' set to ''pre-wrap-auto'' the UA may visually
771+
collapse their character advance widths.
742772
</ol>
743773

744774
<p>White space that was not removed or collapsed during the white space

css-text/Overview.html

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ <h2 class="no-num no-toc no-ref heading settled" id="status"><span class="conten
231231
<li>the <a class="property" data-link-type="propdesc" href="#propdef-text-justify">text-justify</a> property
232232
<li>the percentage values of <a class="property" data-link-type="propdesc" href="#propdef-word-spacing">word-spacing</a>
233233
<li>the <a class="property" data-link-type="propdesc" href="#propdef-hanging-punctuation">hanging-punctuation</a> property
234+
<li>the <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap-auto">pre-wrap-auto</a> value of the <a class="property" data-link-type="propdesc" href="#propdef-white-space">white-space</a> property
234235
</ul></div>
235236

236237

@@ -872,7 +873,7 @@ <h2 class="heading settled" data-level="3" id="white-space-property"><span class
872873

873874
<th><a href="#values">Value</a>:
874875

875-
<td>normal | pre | nowrap | pre-wrap | pre-line
876+
<td>normal | pre | nowrap | pre-wrap | pre-wrap-auto | pre-line
876877

877878

878879

@@ -998,6 +999,18 @@ <h2 class="heading settled" data-level="3" id="white-space-property"><span class
998999
<dd>Like <a class="css" data-link-type="maybe" href="#valdef-white-space-pre">pre</a>, this value preserves <a data-link-type="dfn" href="#white-space">white space</a>;
9991000
but like <a class="css" data-link-type="maybe" href="#valdef-white-space-normal">normal</a>, it allows wrapping.
10001001

1002+
<dt><dfn class="css" data-dfn-for="white-space" data-dfn-type="value" data-export="" id="valdef-white-space-pre-wrap-auto">pre-wrap-auto<a class="self-link" href="#valdef-white-space-pre-wrap-auto"></a></dfn>
1003+
1004+
1005+
<dd>Like <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap">pre-wrap</a>, this value preserves <i>white space</i> and allows wrapping.
1006+
However, some of the behavior is made UA dependent
1007+
(See <a href="#white-space-rules">The White Space Processing Rules</a>
1008+
for details).
1009+
This flexibility allows UAs to match platform conventions,
1010+
in particular with respect to multi-line editable text fields,
1011+
and when preserved <a data-link-type="dfn" href="#white-space">white space</a> at the end a line
1012+
would cause the line to overflow.
1013+
10011014
<dt><dfn class="css" data-dfn-for="white-space" data-dfn-type="value" data-export="" id="valdef-white-space-pre-line">pre-line<a class="self-link" href="#valdef-white-space-pre-line"></a></dfn>
10021015

10031016

@@ -1006,6 +1019,12 @@ <h2 class="heading settled" data-level="3" id="white-space-property"><span class
10061019

10071020
</dl>
10081021

1022+
1023+
<p class="issue" id="issue-5b12ad37"><a class="self-link" href="#issue-5b12ad37"></a> Suggestions of a better name for <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap-auto">pre-wrap-auto</a> are welcome.</p>
1024+
1025+
1026+
<p class="note" role="note">Note: <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap-auto">pre-wrap-auto</a> is at risk.</p>
1027+
10091028

10101029
<p>The following informative table summarizes the behavior of various
10111030
<a class="property" data-link-type="propdesc" href="#propdef-white-space">white-space</a> values:</p>
@@ -1105,6 +1124,22 @@ <h2 class="heading settled" data-level="3" id="white-space-property"><span class
11051124

11061125

11071126

1127+
<tr>
1128+
1129+
<th><a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap-auto">pre-wrap-auto</a>
1130+
1131+
1132+
<td>Preserve
1133+
1134+
1135+
<td>Preserve
1136+
1137+
1138+
<td>Wrap
1139+
1140+
1141+
1142+
11081143
<tr>
11091144

11101145
<th><a class="css" data-link-type="maybe" href="#valdef-white-space-pre-line">pre-line</a>
@@ -1280,6 +1315,16 @@ <h4 class="heading settled" data-level="4.1.1" id="white-space-phase-1"><span cl
12801315
and at the end of the sequence.</p>
12811316

12821317

1318+
<li>
1319+
<p>If <a class="property" data-link-type="propdesc" href="#propdef-white-space">white-space</a> is set to <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap-auto">pre-wrap-auto</a>,
1320+
any sequence of spaces is preserved.
1321+
This is achieved by treating it as a sequence of non-breaking spaces.
1322+
However, unlike with <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap">pre-wrap</a>,
1323+
whether <a data-link-type="dfn" href="#soft-wrap-opportunity">soft wrap opportunities</a> exist in this sequence
1324+
is user-agent defined.
1325+
These UA-specific rules may be context dependent.</p>
1326+
1327+
12831328
</ul>
12841329

12851330

@@ -1346,7 +1391,7 @@ <h4 class="heading settled" data-level="4.1.2" id="line-break-transform"><span c
13461391

13471392

13481393

1349-
<p>When <a class="property" data-link-type="propdesc" href="#propdef-white-space">white-space</a> is <a class="css" data-link-type="maybe" href="#valdef-white-space-pre">pre</a>, <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap">pre-wrap</a>, or <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-line">pre-line</a>,
1394+
<p>When <a class="property" data-link-type="propdesc" href="#propdef-white-space">white-space</a> is <a class="css" data-link-type="maybe" href="#valdef-white-space-pre">pre</a>, <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap">pre-wrap</a>, <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap-auto">pre-wrap-auto</a>, or <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-line">pre-line</a>,
13501395
<a data-link-type="dfn" href="#segment-break">segment breaks</a> are not <a data-link-type="dfn" href="#collapsible-white-space">collapsible</a>
13511396
and are instead transformed into a preserved line feed (U+000A).
13521397

@@ -1406,6 +1451,10 @@ <h4 class="heading settled" data-level="4.1.3" id="white-space-phase-2"><span cl
14061451
The tab size is given by the <a class="property" data-link-type="propdesc" href="#propdef-tab-size">tab-size</a> property.
14071452

14081453
<li>A sequence of <a data-link-type="dfn" href="#collapsible-white-space">collapsible</a> spaces at the end of a line is removed.
1454+
1455+
<li>If spaces or tabs at the end of a line are non-collapsible but
1456+
have <a class="property" data-link-type="propdesc" href="#propdef-white-space">white-space</a> set to <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap-auto">pre-wrap-auto</a> the UA may visually
1457+
collapse their character advance widths.
14091458

14101459
</ol>
14111460

@@ -5032,6 +5081,7 @@ <h3 class="no-num heading settled" id="index-defined-here"><span class="content"
50325081
<li>pre-line, <a href="#valdef-white-space-pre-line">3</a>
50335082
<li>preserved, <a href="#preserved">4.1.3</a>
50345083
<li>pre-wrap, <a href="#valdef-white-space-pre-wrap">3</a>
5084+
<li>pre-wrap-auto, <a href="#valdef-white-space-pre-wrap-auto">3</a>
50355085
<li>right, <a href="#valdef-text-align-right">7.1</a>
50365086
<li>Script property, <a href="#unicode-script">Unnumbered section</a>
50375087
<li>segment break, <a href="#segment-break">4</a>
@@ -5189,7 +5239,7 @@ <h2 class="no-num heading settled" id="property-index"><span class="content">Pro
51895239
<td>as specified
51905240
<tr>
51915241
<th scope="row"><a class="css" data-link-type="property" href="#propdef-white-space">white-space</a>
5192-
<td>normal | pre | nowrap | pre-wrap | pre-line
5242+
<td>normal | pre | nowrap | pre-wrap | pre-wrap-auto | pre-line
51935243
<td>normal
51945244
<td>all elements
51955245
<td>yes
@@ -5374,6 +5424,7 @@ <h2 class="no-num heading settled" id="property-index"><span class="content">Pro
53745424
<td>as specified</table>
53755425
<h2 class="no-num heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
53765426
<div style="counter-reset:issue">
5427+
<div class="issue"> Suggestions of a better name for <a class="css" data-link-type="maybe" href="#valdef-white-space-pre-wrap-auto">pre-wrap-auto</a> are welcome.<a href="#issue-5b12ad37"></a></div>
53775428
<div class="feedback issue">Comments on how well this would work in practice would
53785429
be very much appreciated, particularly from people who work with
53795430
Thai and similar scripts.

0 commit comments

Comments
 (0)