Skip to content

Commit c9b4f7f

Browse files
fantasaifrivoal
authored andcommitted
[css-text-4] Normative integration of 'white-space' longhands and white space processing rules.
1 parent ab2346e commit c9b4f7f

File tree

1 file changed

+46
-43
lines changed

1 file changed

+46
-43
lines changed

css-text-4/Overview.bs

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ White Space and Wrapping: the 'white-space' property</h2>
18071807
Note: This shorthand combines both inheritable and non-inheritable properties.
18081808
If this is a problem, please inform the CSSWG.
18091809

1810-
The following table gives the mapping of the values of the shorthand to its longhands.
1810+
The following table gives the normative mapping of the values of the shorthand to its longhands.
18111811

18121812
<table class="data">
18131813
<colgroup class="header"></colgroup>
@@ -1853,15 +1853,9 @@ White Space and Wrapping: the 'white-space' property</h2>
18531853
</tbody>
18541854
</table>
18551855

1856-
ISSUE: The following is the normative definition from Level 3;
1857-
once [[#white-space-rules]] is updated
1858-
(assumming we still want to go in this direction),
1859-
this text should be merged into its longhands’ definitions.
1856+
Values have the following informative definitions:
18601857

1861-
Values have the following meanings,
1862-
which must be interpreted according to
1863-
the [[#white-space-rules|White Space Processing]] and
1864-
[[#line-breaking|Line Breaking]] rules:
1858+
ISSUE: Remove these definitions once the tests annotations have been redistributed.
18651859

18661860
<dl dfn-for=white-space dfn-type=value>
18671861
<dt><dfn>normal</dfn>
@@ -2189,7 +2183,7 @@ White Space Processing &amp; Control Characters</h2>
21892183
to control interpretation of such formatting:
21902184
to preserve or collapse it away when rendering the document.
21912185
White space processing in CSS
2192-
(which is controlled with the 'white-space' property)
2186+
(which is controlled with the 'white-space-collapse' and 'text-space-trim' properties)
21932187
interprets [=white space characters=] only for rendering:
21942188
it has no effect on the underlying document data.
21952189

@@ -2369,7 +2363,6 @@ White Space Processing &amp; Control Characters</h2>
23692363
White Space Collapsing: the 'white-space-collapse' property</h3>
23702364

23712365
ISSUE: This section is still under discussion and may change in future drafts.
2372-
It also hasn't been integrated into the white space processing rules (below).
23732366

23742367
<pre class="propdef">
23752368
Name: white-space-collapse
@@ -2382,36 +2375,38 @@ White Space Collapsing: the 'white-space-collapse' property</h3>
23822375
Animation type: discrete
23832376
</pre>
23842377

2385-
This property declares whether and how
2378+
This property specifies whether and how
23862379
<a href="#white-space-processing">white space</a>
23872380
is collapsed.
23882381
Values have the following meanings,
2389-
which must be interpreted according to the white space processing rules:
2382+
which must be interpreted according to
2383+
the [[#white-space-rules|White Space Processing Rules]]:
23902384

23912385
<dl dfn-for=white-space-collapse dfn-type=value>
23922386
<dt><dfn>collapse</dfn>
23932387
<dd>
2394-
This value directs user agents to collapse sequences of white space
2388+
This value directs user agents to collapse sequences of [=white space=]
23952389
into a single character
2396-
(or <a href="https://www.w3.org/TR/css-text/#line-break-transform">in some cases</a>, no character).
2390+
(or <a href="#line-break-transform">in some cases</a>, no character).
23972391

23982392
<dt><dfn>preserve</dfn>
23992393
<dd>
2400-
This value prevents user agents
2401-
from collapsing sequences of white space.
2402-
<a>Segment breaks</a> are preserved as forced line breaks.
2394+
This value prevents user agents from collapsing sequences of [=white space=].
2395+
<a>Segment breaks</a> such as line feeds
2396+
are preserved as [=forced line breaks=].
24032397

24042398
<dt><dfn>preserve-breaks</dfn>
24052399
<dd>
2406-
This value collapses white space as for ''collapse'', but preserves
2407-
<a>segment breaks</a> as forced line breaks.
2400+
Like ''white-space-collapse/collapse'',
2401+
this value collapses consecutive [=white space characters=],
2402+
but preserves [=segment breaks=] in the source as [=forced line breaks=].
24082403

24092404
<dt><dfn>preserve-spaces</dfn>
24102405
<dd>
24112406
This value prevents user agents
2412-
from collapsing sequences of white space,
2413-
and converts tabs and <a>segment breaks</a> to spaces.
2414-
(This value is intended to match the behavior
2407+
from collapsing sequences of [=white space=],
2408+
and converts [=tabs=] and [=segment breaks=] to [=spaces=].
2409+
(This value is intended to represent the behavior
24152410
of <code>xml:space="preserve"</code> in SVG.)
24162411

24172412
<dt><dfn>break-spaces</dfn>
@@ -2601,8 +2596,7 @@ White Space Trimming: the 'text-space-trim' property</h3>
26012596

26022597
This property allows authors to specify trimming behavior
26032598
at the beginning and end of a box.
2604-
Values have the following meanings,
2605-
which must be interpreted according to the white space processing rules:
2599+
Values have the following meanings:
26062600

26072601
<dl dfn-for=text-space-trim dfn-type=value>
26082602
<dt><dfn>discard-inner</dfn>
@@ -2734,7 +2728,7 @@ Phase I: Collapsing and Transformation</h4>
27342728

27352729
<ul>
27362730
<li id="collapse">
2737-
If 'white-space' is set to ''white-space/normal'', ''white-space/nowrap'', or ''pre-line'',
2731+
If 'white-space-collapse' is set to ''white-space-collapse/collapse'' or ''preserve-breaks'',
27382732
[=white space characters=] are considered <dfn export lt="collapsible white space" local-lt="collapsible">collapsible</dfn>
27392733
and are processed by performing the following steps:
27402734

@@ -2834,11 +2828,15 @@ Phase I: Collapsing and Transformation</h4>
28342828
</ol>
28352829

28362830
<li>
2837-
If 'white-space' is set to ''pre'', ''pre-wrap'', or ''break-spaces'',
2838-
any sequence of spaces is treated as a sequence of non-breaking spaces.
2839-
However, for ''pre-wrap'',
2840-
a [=soft wrap opportunity=] exists at the end of a sequence of [=spaces=] and/or [=tabs=],
2841-
while for ''break-spaces'',
2831+
If 'white-space-collapse' is set to ''preserve-spaces'',
2832+
each [=tab=] and [=segment break=] is converted to a [=space=].
2833+
2834+
<li>
2835+
If 'white-space-collapse' is set to ''preserve'' or ''preserve-spaces'',
2836+
any sequence of spaces is treated as a sequence of non-breaking spaces
2837+
except that
2838+
a [=soft wrap opportunity=] exists at the end of each maximal sequence of [=spaces=] and/or [=tabs=].
2839+
For ''break-spaces'',
28422840
a [=soft wrap opportunity=] exists after every [=space=] and every [=tab=].
28432841

28442842
<wpt>
@@ -2974,7 +2972,7 @@ Phase II: Trimming and Positioning</h4>
29742972
Then, the entire block is rendered.
29752973
Inlines are laid out,
29762974
taking [[css-writing-modes-4#text-direction|bidi reordering]] into account,
2977-
and [=wrapping=] as specified by the 'white-space' property.
2975+
and [=wrapping=] as specified by the 'text-wrap' property.
29782976
As each line is laid out,
29792977

29802978
<ol>
@@ -3015,7 +3013,7 @@ Phase II: Trimming and Positioning</h4>
30153013
Otherwise, each [=preserved=] [=tab=] is rendered
30163014
as a horizontal shift that lines up
30173015
the start edge of the next glyph with the next [=tab stop=].
3018-
If this distance is less than 0.5<a value class=no-quote>ch</a>,
3016+
If this distance is less than ''0.5ch'',
30193017
then the subsequent [=tab stop=] is used instead.
30203018
<dfn lt="tab stop">Tab stops</dfn> occur at points
30213019
that are multiples of the [=tab size=]
@@ -3051,7 +3049,7 @@ Phase II: Trimming and Positioning</h4>
30513049
A sequence of [=collapsible=] [=spaces=]
30523050
at the end of a line is removed,
30533051
as well as any trailing U+1680 &#x1680; OGHAM SPACE MARK
3054-
whose 'white-space' property is ''white-space/normal'', ''white-space/nowrap'', or ''pre-line''.
3052+
whose 'white-space-collapse' property is ''white-space-collapse/collapse'' or ''white-space-collapse/preserve-breaks''.
30553053

30563054
<wpt>
30573055
white-space/line-edge-white-space-collapse-001.html
@@ -3099,9 +3097,7 @@ Phase II: Trimming and Positioning</h4>
30993097

31003098
<ul>
31013099
<li>
3102-
If 'white-space' is set to ''white-space/normal'',
3103-
''white-space/nowrap'',
3104-
or ''white-space/pre-line'',
3100+
If 'white-space-collapse' is ''white-space-collapse/collapse'' or ''white-space-collapse/preserve-breaks'',
31053101
the UA must [=hang=] this sequence (unconditionally).
31063102

31073103
<wpt>
@@ -3137,7 +3133,8 @@ Phase II: Trimming and Positioning</h4>
31373133
</wpt>
31383134

31393135
<li>
3140-
If 'white-space' is set to ''pre-wrap'',
3136+
If 'white-space-collapse' is ''white-space-collapse/preserve''
3137+
and 'text-wrap' is not ''text-wrap/nowrap'',
31413138
the UA must (unconditionally) [=hang=] this sequence,
31423139
unless the sequence is followed by a [=forced line break=],
31433140
in which case it must [=conditionally hang=] the sequence instead.
@@ -3207,7 +3204,7 @@ Phase II: Trimming and Positioning</h4>
32073204
allows users to see the space when selecting or editing text.
32083205

32093206
<li>
3210-
If 'white-space' is set to ''break-spaces'',
3207+
If 'white-space-collapse' is set to ''break-spaces'',
32113208
[=spaces=], [=tabs=], and [=other space separators=]
32123209
are treated the same as other visible characters:
32133210
they cannot [=hang=] nor have their advance width collapsed.
@@ -3258,6 +3255,7 @@ Phase II: Trimming and Positioning</h4>
32583255
will either overflow or cause the line to wrap.
32593256
</ul>
32603257

3258+
ISSUE: What should happen here for ''white-space-collapse: preserve-spaces''?
32613259
</ol>
32623260

32633261
<div class=example>
@@ -3369,9 +3367,12 @@ Segment Break Transformation Rules</h4>
33693367
test for other features that rely on this,
33703368
rather than by dedicated tests."></wpt>
33713369

3372-
When 'white-space' is ''pre'', ''pre-wrap'', ''break-spaces'', or ''pre-line'',
3373-
[=segment breaks=] are not [=collapsible=]
3374-
and are instead transformed into a preserved line feed (U+000A).
3370+
When 'white-space-collapse' is not ''white-space-collapse/collapse'',
3371+
[=segment breaks=] are not [=collapsible=].
3372+
For values other than ''white-space-collapse/collapse''
3373+
or ''white-space-collapse/preserve-spaces''
3374+
(which transforms them into [=spaces=]),
3375+
[=segment breaks=] are instead transformed into a preserved line feed (U+000A).
33753376

33763377
<wpt pathprefix="/css/CSS2/text/">
33773378
white-space-008.xht
@@ -3380,7 +3381,7 @@ Segment Break Transformation Rules</h4>
33803381
white-space-processing-018.xht
33813382
</wpt>
33823383

3383-
For other values of 'white-space',
3384+
When 'white-space-collapse' is ''white-space-collapse/collapse'',
33843385
[=segment breaks=] are [=collapsible=],
33853386
and are collapsed as follows:
33863387

@@ -3397,6 +3398,8 @@ Segment Break Transformation Rules</h4>
33973398
depending on the context before and after the break.
33983399
The rules for this operation are UA-defined in this level.
33993400

3401+
ISSUE: Should we define this for Level 4?
3402+
34003403
<!-- CUT SEGMENT BREAK TRANSFORM
34013404
<wpt pathprefix="/css/css-text/line-breaking/">
34023405
segment-break-transformation-removable-2.html

0 commit comments

Comments
 (0)