Skip to content

Commit 2a5b5e4

Browse files
committed
[css-text-4] Add pretty/stable values to text-wrapper F2F discussions. #672
1 parent 2dac521 commit 2a5b5e4

File tree

1 file changed

+41
-21
lines changed

1 file changed

+41
-21
lines changed

css-text-4/Overview.bs

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ Text Wrap Settings: the 'text-wrap' property</h3>
178178

179179
<pre class="propdef">
180180
Name: text-wrap
181-
Value: wrap | nowrap | balance
181+
Value: wrap | nowrap | balance | stable | pretty
182182
Initial: wrap
183183
Applies to: <a>inline boxes</a> and <a>block containers</a>
184184
Inherited: yes
@@ -199,8 +199,13 @@ Text Wrap Settings: the 'text-wrap' property</h3>
199199
in order to minimize <a>inline-axis</a> overflow.
200200

201201
The exact algorithm is UA-defined.
202-
The algorithm may consider multiple lines when making break decisions.
203-
The UA may bias for speed over best layout.
202+
The algorithm <em>may</em> consider multiple lines
203+
when making break decisions.
204+
The UA <em>may</em> bias for speed over best layout.
205+
The UA <em>must not</em> attempt to even out all lines
206+
(including the last) as for ''text-wrap/balance''.
207+
This value selects the UA’s preferred (or most Web-compatible)
208+
wrapping algorithm.
204209

205210
<dt><dfn>nowrap</dfn>
206211
<dd>
@@ -230,9 +235,26 @@ Text Wrap Settings: the 'text-wrap' property</h3>
230235
The exact algorithm is UA-defined.
231236

232237
UAs may treat this value as ''text-wrap/wrap'' if there are more than ten lines to balance.
233-
</dl>
234238

235-
ISSUE: There's some discussion about whether different wrapping algorithms (higher quality vs faster) need special keywords, see <a href="https://github.com/w3c/csswg-drafts/issues/672#issuecomment-379723243">Issue 672</a>.
239+
<dt><dfn>stable</dfn>
240+
<dd>
241+
When applied to a <a>block container</a>
242+
that establishes an <a>inline formatting context</a>,
243+
specifies that content on subsequent lines
244+
<em>should not</em> be considered when making break decisions
245+
so that when editing text any content before the cursor
246+
remains stable;
247+
otherwise equivalent to ''text-wrap/wrap'',
248+
249+
<dt><dfn>pretty</dfn>
250+
<dd>
251+
When applied to a <a>block container</a>
252+
that establishes an <a>inline formatting context</a>,
253+
specifies the UA <em>should</em> bias for better layout over speed,
254+
and is expected to consider multiple lines,
255+
when making break decisions.
256+
Otherwise equivalent to ''text-wrap/wrap'',
257+
</dl>
236258

237259
Regardless of the 'text-wrap' value,
238260
lines always break at forced breaks:
@@ -262,24 +284,22 @@ Text Wrap Settings: the 'text-wrap' property</h3>
262284

263285
<!-- add a sample prioritization algorithm -->
264286

265-
Note: The ''text-wrap/wrap'' value is intended
266-
for speedy legacy line breaking,
267-
which has so far used first-fit/greedy algorithms
287+
Note: The ''text-wrap/wrap'' value is will typically map
288+
to Web browsers’ speedy legacy line breaking,
289+
which has so far used first-fit/greedy algorithms
268290
that can often give sub-optimal results.
269-
UAs could experiment with better line breaking algorithms
291+
UAs can experiment with better line breaking algorithms
270292
with this default value,
271-
but optimal results will probably take more time.
272-
The ''text-wrap/multi-line'' and ''text-wrap/balance'' values
273-
are intended as opt-in choices to take more time for better results.
274-
The ''text-wrap/balance'' value is intended for titles and captions,
275-
and the ''text-wrap/multi-line'' is intended for body text.
276-
277-
Note: Some line breaking algorithms can interact unexpectedly with editing.
278-
Changing upstream line breaks on user edits can be unsettling.
279-
As UAs experiment with better line breaking algorithms,
280-
we will likely need to add a property
281-
to constrain upstream changes while editing.
282-
293+
but as optimal results often take more time,
294+
''text-wrap/pretty'' is offered as an opt-in
295+
to take more time for better results.
296+
The ''text-wrap/pretty'' value is intended for body text,
297+
where the last line is expected to be a bit shorter than the average line;
298+
the ''text-wrap/balance'' value is intended for titles and captions,
299+
where equal-length lines of text tend to be preferred;
300+
and the ''text-wrap/stable'' is intended for sections that are,
301+
or are likely become toggled as,
302+
editable.
283303
<h3 id="wrap-before">
284304
Inline breaks between boxes: the 'wrap-before'/'wrap-after' properties</h3>
285305

0 commit comments

Comments
 (0)