Skip to content

Commit 631d25e

Browse files
committed
[editorial][css-text-4] Reorder sub-sections in "Text Wrapping"
This brings text-wrap-mode and the wrap-inside/before/after properties closer to each other, which is good since they control similar things (can you wrap?).
1 parent dc76560 commit 631d25e

File tree

1 file changed

+165
-168
lines changed

1 file changed

+165
-168
lines changed

css-text-4/Overview.bs

+165-168
Original file line numberDiff line numberDiff line change
@@ -4098,7 +4098,7 @@ Tab Character Size: the 'tab-size' property</h3>
40984098
white-space-processing-042.xht
40994099
</wpt>
41004100

4101-
<h2 id="text-wrapping">
4101+
<h2 id="text-wrapping" oldids="text-wrap">
41024102
Text Wrapping</h2>
41034103

41044104
<wpt title="
@@ -4142,38 +4142,8 @@ Text Wrapping</h2>
41424142
and
41434143
'wrap-inside' properties.
41444144

4145-
<h3 id="text-wrap">
4146-
Text Wrap Setting</h3>
4147-
4148-
<h4 id="text-wrap-shorthand">
4149-
Joint Wrapping Control: the 'text-wrap' shorthand property</h4>
4150-
4151-
<wpt title="This section has limited coverage."></wpt>
4152-
4153-
<pre class="propdef">
4154-
Name: text-wrap
4155-
Value: <'text-wrap-mode'> || <'text-wrap-style'>
4156-
Initial: wrap
4157-
Applies to: see individual properties
4158-
Inherited: see individual properties
4159-
Percentages: see individual properties
4160-
Computed value: see individual properties
4161-
Animation type: see individual properties
4162-
</pre>
4163-
4164-
<wpt>
4165-
parsing/text-wrap-invalid.html
4166-
parsing/text-wrap-valid.html
4167-
</wpt>
4168-
<wpt title="TODO: needs review, probably outdated">
4169-
parsing/white-space-shorthand-text-wrap.html
4170-
</wpt>
4171-
4172-
This property is a shorthand for 'text-wrap-mode' and 'text-wrap-style' properties.
4173-
Any omitted [=longhand=] is set to its [=initial value=].
4174-
4175-
<h4 id="text-wrap-mode">
4176-
Deciding Whether to Wrap: the 'text-wrap-mode' property</h4>
4145+
<h3 id="text-wrap-mode">
4146+
Deciding Whether to Wrap: the 'text-wrap-mode' property</h3>
41774147

41784148
<wpt title="
41794149
This property is tested extensively through its shorthands,
@@ -5335,141 +5305,6 @@ Deciding Whether to Wrap: the 'text-wrap-mode' property</h4>
53355305
are defined by the <a href="https://www.unicode.org/reports/tr9/"><cite>Unicode Bidirectional Algorithm</cite></a>.
53365306
[[!UAX9]]
53375307

5338-
<h4 id="text-wrap-style">
5339-
Selecting How to Wrap: the 'text-wrap-style' property</h4>
5340-
5341-
<wpt title="
5342-
This property has limited coverage.
5343-
5344-
Missing test:
5345-
* tests for values other than balance
5346-
* Direct tests of this property as a longhand"></wpt>
5347-
5348-
<pre class="propdef">
5349-
Name: text-wrap-style
5350-
Value: auto| balance | stable | pretty
5351-
Initial: auto
5352-
Applies to: [=block containers=] hat establish an [=inline formatting context=]
5353-
Inherited: yes
5354-
Percentages: n/a
5355-
Computed value: specified keyword
5356-
Animation type: discrete
5357-
</pre>
5358-
5359-
When wrapping is allowed
5360-
(see 'text-wrap-mode'),
5361-
this property selects between several approaches for wrapping lines,
5362-
trading off between speed, quality and style of layout, or stability.
5363-
It does not change which [=soft wrap opportunity=] exist,
5364-
but changes how the user agent selects among them.
5365-
Possible values:
5366-
5367-
<dl dfn-for=text-wrap-style dfn-type=value>
5368-
<dt><dfn>auto</dfn>
5369-
<dd>
5370-
The exact algorithm for selecting
5371-
which [=soft wrap opportunity=] to break at is UA-defined.
5372-
The algorithm <em>may</em> consider multiple lines
5373-
when making break decisions.
5374-
The UA <em>may</em> bias for speed over best layout.
5375-
The UA <em>must not</em> attempt to even out all lines
5376-
(including the last) as for ''text-wrap-style/balance''.
5377-
This value selects the UA’s preferred (or most Web-compatible)
5378-
wrapping algorithm.
5379-
5380-
<dt><dfn>balance</dfn>
5381-
<dd>
5382-
Line breaks are chosen to balance
5383-
the remaining (empty) space in each line box,
5384-
if better balance than ''text-wrap-style/auto'' is possible.
5385-
This must not change the number of line boxes
5386-
the block would contain
5387-
if 'text-wrap' were set to ''text-wrap-style/auto''.
5388-
5389-
<wpt>
5390-
white-space/text-wrap-balance-001.html
5391-
white-space/text-wrap-balance-002.html
5392-
white-space/text-wrap-balance-align-001.html
5393-
white-space/text-wrap-balance-dynamic-001.html
5394-
white-space/text-wrap-balance-line-clamp-001.html
5395-
white-space/text-wrap-balance-narrow-crash.html
5396-
crashtests/text-wrap-balance-float-crash.html
5397-
</wpt>
5398-
5399-
The remaining space to consider
5400-
is that which remains after placing floats and inline content,
5401-
but before any adjustments due to text justification.
5402-
Line boxes are balanced when the standard deviation
5403-
from the average <a>inline-size</a> of the remaining space in each line box
5404-
is reduced over the block
5405-
(including lines that end in a forced break).
5406-
5407-
<wpt>
5408-
white-space/text-wrap-balance-text-indent-001.html
5409-
</wpt>
5410-
5411-
The exact algorithm is UA-defined.
5412-
5413-
UAs may treat this value as ''text-wrap-style/auto'' if there are more than ten lines to balance.
5414-
5415-
<dt><dfn>stable</dfn>
5416-
<dd>
5417-
Specifies that content on subsequent lines
5418-
<em>should not</em> be considered when making break decisions
5419-
so that when editing text any content before the cursor
5420-
remains stable;
5421-
otherwise equivalent to ''text-wrap-style/auto'',
5422-
5423-
<dt><dfn>pretty</dfn>
5424-
<dd>
5425-
Specifies the UA <em>should</em> bias for better layout over speed,
5426-
and is expected to consider multiple lines,
5427-
when making break decisions.
5428-
Otherwise equivalent to ''text-wrap-style/auto'',
5429-
</dl>
5430-
5431-
<!-- add a sample prioritization algorithm -->
5432-
5433-
Note: The ''text-wrap-style/auto'' value will typically map
5434-
to Web browsers’ speedy legacy line breaking,
5435-
which has so far used first-fit/greedy algorithms
5436-
that can often give sub-optimal results.
5437-
UAs can experiment with better line breaking algorithms
5438-
with this default value,
5439-
but as optimal results often take more time,
5440-
''text-wrap-style/pretty'' is offered as an opt-in
5441-
to take more time for better results.
5442-
The ''text-wrap-style/pretty'' value is intended for body text,
5443-
where the last line is expected to be a bit shorter than the average line;
5444-
the ''text-wrap-style/balance'' value is intended for titles and captions,
5445-
where equal-length lines of text tend to be preferred;
5446-
and the ''text-wrap-style/stable'' is intended for sections that are,
5447-
or are likely become toggled as,
5448-
editable.
5449-
5450-
<div class="issue" id="last-line-limits">
5451-
See <a href="http://www.w3.org/mid/0BD85DFF-A147-44EF-B18A-FF03C3D67EF0@verou.me">thread</a>.
5452-
Issue is about requiring a minimum length for lines.
5453-
Common measures seem to be
5454-
5455-
<ul>
5456-
<li>At least as long as the text-indent.
5457-
<li>At least X characters.
5458-
<li>Percentage-based.
5459-
</ul>
5460-
5461-
Suggestion for value space is ''match-indent | <<length>> | <<percentage>>''
5462-
(with ''Xch'' given as an example to make that use case clear).
5463-
Alternately <<integer>> could actually count the characters.
5464-
5465-
It's unclear how this would interact with text balancing (above);
5466-
one earlier proposal had them be the same property
5467-
(with ''100%'' meaning full balancing).
5468-
5469-
People have requested word-based limits, but since this is really
5470-
dependent on the length of the word, character-based is better.
5471-
</div>
5472-
54735308
<h3 id="wrap-inside">
54745309
Controlling Breaks Within Boxes: the 'wrap-inside' property</h3>
54755310

@@ -5626,6 +5461,168 @@ Controlling Breaks Between Boxes: the 'wrap-before'/'wrap-after' properties</h3>
56265461
in the same <a>fragmentation context</a>.
56275462
[[!CSS3-BREAK]]
56285463

5464+
<h3 id="text-wrap-style">
5465+
Selecting How to Wrap: the 'text-wrap-style' property</h3>
5466+
5467+
<wpt title="
5468+
This property has limited coverage.
5469+
5470+
Missing test:
5471+
* tests for values other than balance
5472+
* Direct tests of this property as a longhand"></wpt>
5473+
5474+
<pre class="propdef">
5475+
Name: text-wrap-style
5476+
Value: auto| balance | stable | pretty
5477+
Initial: auto
5478+
Applies to: [=block containers=] hat establish an [=inline formatting context=]
5479+
Inherited: yes
5480+
Percentages: n/a
5481+
Computed value: specified keyword
5482+
Animation type: discrete
5483+
</pre>
5484+
5485+
When wrapping is allowed
5486+
(see 'text-wrap-mode'),
5487+
this property selects between several approaches for wrapping lines,
5488+
trading off between speed, quality and style of layout, or stability.
5489+
It does not change which [=soft wrap opportunity=] exist,
5490+
but changes how the user agent selects among them.
5491+
Possible values:
5492+
5493+
<dl dfn-for=text-wrap-style dfn-type=value>
5494+
<dt><dfn>auto</dfn>
5495+
<dd>
5496+
The exact algorithm for selecting
5497+
which [=soft wrap opportunity=] to break at is UA-defined.
5498+
The algorithm <em>may</em> consider multiple lines
5499+
when making break decisions.
5500+
The UA <em>may</em> bias for speed over best layout.
5501+
The UA <em>must not</em> attempt to even out all lines
5502+
(including the last) as for ''text-wrap-style/balance''.
5503+
This value selects the UA’s preferred (or most Web-compatible)
5504+
wrapping algorithm.
5505+
5506+
<dt><dfn>balance</dfn>
5507+
<dd>
5508+
Line breaks are chosen to balance
5509+
the remaining (empty) space in each line box,
5510+
if better balance than ''text-wrap-style/auto'' is possible.
5511+
This must not change the number of line boxes
5512+
the block would contain
5513+
if 'text-wrap' were set to ''text-wrap-style/auto''.
5514+
5515+
<wpt>
5516+
white-space/text-wrap-balance-001.html
5517+
white-space/text-wrap-balance-002.html
5518+
white-space/text-wrap-balance-align-001.html
5519+
white-space/text-wrap-balance-dynamic-001.html
5520+
white-space/text-wrap-balance-line-clamp-001.html
5521+
white-space/text-wrap-balance-narrow-crash.html
5522+
crashtests/text-wrap-balance-float-crash.html
5523+
</wpt>
5524+
5525+
The remaining space to consider
5526+
is that which remains after placing floats and inline content,
5527+
but before any adjustments due to text justification.
5528+
Line boxes are balanced when the standard deviation
5529+
from the average <a>inline-size</a> of the remaining space in each line box
5530+
is reduced over the block
5531+
(including lines that end in a forced break).
5532+
5533+
<wpt>
5534+
white-space/text-wrap-balance-text-indent-001.html
5535+
</wpt>
5536+
5537+
The exact algorithm is UA-defined.
5538+
5539+
UAs may treat this value as ''text-wrap-style/auto'' if there are more than ten lines to balance.
5540+
5541+
<dt><dfn>stable</dfn>
5542+
<dd>
5543+
Specifies that content on subsequent lines
5544+
<em>should not</em> be considered when making break decisions
5545+
so that when editing text any content before the cursor
5546+
remains stable;
5547+
otherwise equivalent to ''text-wrap-style/auto'',
5548+
5549+
<dt><dfn>pretty</dfn>
5550+
<dd>
5551+
Specifies the UA <em>should</em> bias for better layout over speed,
5552+
and is expected to consider multiple lines,
5553+
when making break decisions.
5554+
Otherwise equivalent to ''text-wrap-style/auto'',
5555+
</dl>
5556+
5557+
<!-- add a sample prioritization algorithm -->
5558+
5559+
Note: The ''text-wrap-style/auto'' value will typically map
5560+
to Web browsers’ speedy legacy line breaking,
5561+
which has so far used first-fit/greedy algorithms
5562+
that can often give sub-optimal results.
5563+
UAs can experiment with better line breaking algorithms
5564+
with this default value,
5565+
but as optimal results often take more time,
5566+
''text-wrap-style/pretty'' is offered as an opt-in
5567+
to take more time for better results.
5568+
The ''text-wrap-style/pretty'' value is intended for body text,
5569+
where the last line is expected to be a bit shorter than the average line;
5570+
the ''text-wrap-style/balance'' value is intended for titles and captions,
5571+
where equal-length lines of text tend to be preferred;
5572+
and the ''text-wrap-style/stable'' is intended for sections that are,
5573+
or are likely become toggled as,
5574+
editable.
5575+
5576+
<div class="issue" id="last-line-limits">
5577+
See <a href="http://www.w3.org/mid/0BD85DFF-A147-44EF-B18A-FF03C3D67EF0@verou.me">thread</a>.
5578+
Issue is about requiring a minimum length for lines.
5579+
Common measures seem to be
5580+
5581+
<ul>
5582+
<li>At least as long as the text-indent.
5583+
<li>At least X characters.
5584+
<li>Percentage-based.
5585+
</ul>
5586+
5587+
Suggestion for value space is ''match-indent | <<length>> | <<percentage>>''
5588+
(with ''Xch'' given as an example to make that use case clear).
5589+
Alternately <<integer>> could actually count the characters.
5590+
5591+
It's unclear how this would interact with text balancing (above);
5592+
one earlier proposal had them be the same property
5593+
(with ''100%'' meaning full balancing).
5594+
5595+
People have requested word-based limits, but since this is really
5596+
dependent on the length of the word, character-based is better.
5597+
</div>
5598+
5599+
<h3 id="text-wrap-shorthand">
5600+
Joint Wrapping Control: the 'text-wrap' shorthand property</h3>
5601+
5602+
<wpt title="This section has limited coverage."></wpt>
5603+
5604+
<pre class="propdef">
5605+
Name: text-wrap
5606+
Value: <'text-wrap-mode'> || <'text-wrap-style'>
5607+
Initial: wrap
5608+
Applies to: see individual properties
5609+
Inherited: see individual properties
5610+
Percentages: see individual properties
5611+
Computed value: see individual properties
5612+
Animation type: see individual properties
5613+
</pre>
5614+
5615+
<wpt>
5616+
parsing/text-wrap-invalid.html
5617+
parsing/text-wrap-valid.html
5618+
</wpt>
5619+
<wpt title="TODO: needs review, probably outdated">
5620+
parsing/white-space-shorthand-text-wrap.html
5621+
</wpt>
5622+
5623+
This property is a shorthand for 'text-wrap-mode' and 'text-wrap-style' properties.
5624+
Any omitted [=longhand=] is set to its [=initial value=].
5625+
56295626
<h3 id="line-break-details">
56305627
Line Breaking Details</h3>
56315628

0 commit comments

Comments
 (0)