Skip to content

Commit b95e66d

Browse files
committed
Merge pull request #27 from frivoal/florian/pre-wrap
Florian/pre wrap
2 parents e362c83 + cdbe13c commit b95e66d

File tree

2 files changed

+95
-13
lines changed

2 files changed

+95
-13
lines changed

css-text/Overview.bs

Lines changed: 37 additions & 6 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>
@@ -648,9 +668,20 @@ Languages and Typesetting</h4>
648668
invisible, but retains its <a>soft wrap opportunity</a>, if any.)</li>
649669
</ol>
650670
</li>
651-
<li><p>If 'white-space' is set to ''pre-wrap'', any sequence of
652-
spaces is treated as a sequence of non-breaking spaces. However,
653-
a <a>soft wrap opportunity</a> exists at the end of the sequence.</p></li>
671+
<li><p>If 'white-space' is set to ''pre-wrap'',
672+
any sequence of spaces is preserved.
673+
This is achieved by treating it as a sequence of non-breaking spaces,
674+
except that a <a>soft wrap opportunity</a> exists
675+
between each of the spaces of this preserved sequence,
676+
as well as at the beginning
677+
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>
654685
</ul>
655686

656687
<p>Then, the entire block is rendered. Inlines are laid out, taking bidi
@@ -695,7 +726,7 @@ Languages and Typesetting</h4>
695726
<h4 id="line-break-transform">
696727
Segment Break Transformation Rules</h4>
697728

698-
<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'',
699730
<a>segment breaks</a> are not <a>collapsible</a>
700731
and are instead transformed into a preserved line feed (U+000A).
701732

@@ -736,7 +767,7 @@ Languages and Typesetting</h4>
736767
The tab size is given by the 'tab-size' property.
737768
<li>A sequence of <a>collapsible</a> spaces at the end of a line is removed.
738769
<li>If spaces or tabs at the end of a line are non-collapsible but
739-
have 'white-space' set to ''pre-wrap'' the UA may visually
770+
have 'white-space' set to ''pre-wrap-auto'' the UA may visually
740771
collapse their character advance widths.
741772
</ol>
742773

css-text/Overview.html

Lines changed: 58 additions & 7 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>
@@ -1271,9 +1306,23 @@ <h4 class="heading settled" data-level="4.1.1" id="white-space-phase-1"><span cl
12711306

12721307

12731308
<li>
1274-
<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">pre-wrap</a>, any sequence of
1275-
spaces is treated as a sequence of non-breaking spaces. However,
1276-
a <a data-link-type="dfn" href="#soft-wrap-opportunity">soft wrap opportunity</a> exists at the end of the sequence.</p>
1309+
<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">pre-wrap</a>,
1310+
any sequence of spaces is preserved.
1311+
This is achieved by treating it as a sequence of non-breaking spaces,
1312+
except that a <a data-link-type="dfn" href="#soft-wrap-opportunity">soft wrap opportunity</a> exists
1313+
between each of the spaces of this preserved sequence,
1314+
as well as at the beginning
1315+
and at the end of the sequence.</p>
1316+
1317+
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>
12771326

12781327

12791328
</ul>
@@ -1342,7 +1391,7 @@ <h4 class="heading settled" data-level="4.1.2" id="line-break-transform"><span c
13421391

13431392

13441393

1345-
<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>,
13461395
<a data-link-type="dfn" href="#segment-break">segment breaks</a> are not <a data-link-type="dfn" href="#collapsible-white-space">collapsible</a>
13471396
and are instead transformed into a preserved line feed (U+000A).
13481397

@@ -1404,7 +1453,7 @@ <h4 class="heading settled" data-level="4.1.3" id="white-space-phase-2"><span cl
14041453
<li>A sequence of <a data-link-type="dfn" href="#collapsible-white-space">collapsible</a> spaces at the end of a line is removed.
14051454

14061455
<li>If spaces or tabs at the end of a line are non-collapsible but
1407-
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">pre-wrap</a> the UA may visually
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
14081457
collapse their character advance widths.
14091458

14101459
</ol>
@@ -5033,6 +5082,7 @@ <h3 class="no-num heading settled" id="index-defined-here"><span class="content"
50335082
<li>pre-line, <a href="#valdef-white-space-pre-line">3</a>
50345083
<li>preserved, <a href="#preserved">4.1.3</a>
50355084
<li>pre-wrap, <a href="#valdef-white-space-pre-wrap">3</a>
5085+
<li>pre-wrap-auto, <a href="#valdef-white-space-pre-wrap-auto">3</a>
50365086
<li>right, <a href="#valdef-text-align-right">7.1</a>
50375087
<li>Script property, <a href="#unicode-script">Unnumbered section</a>
50385088
<li>segment break, <a href="#segment-break">4</a>
@@ -5190,7 +5240,7 @@ <h2 class="no-num heading settled" id="property-index"><span class="content">Pro
51905240
<td>as specified
51915241
<tr>
51925242
<th scope="row"><a class="css" data-link-type="property" href="#propdef-white-space">white-space</a>
5193-
<td>normal | pre | nowrap | pre-wrap | pre-line
5243+
<td>normal | pre | nowrap | pre-wrap | pre-wrap-auto | pre-line
51945244
<td>normal
51955245
<td>all elements
51965246
<td>yes
@@ -5375,6 +5425,7 @@ <h2 class="no-num heading settled" id="property-index"><span class="content">Pro
53755425
<td>as specified</table>
53765426
<h2 class="no-num heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
53775427
<div style="counter-reset:issue">
5428+
<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>
53785429
<div class="feedback issue">Comments on how well this would work in practice would
53795430
be very much appreciated, particularly from people who work with
53805431
Thai and similar scripts.

0 commit comments

Comments
 (0)