Skip to content

Commit 995a077

Browse files
frivoalkojiishi
authored andcommitted
[css-text-3] break spaces (#111)
* [css-text] Add 'break-spaces' Based on resolutions from the 2016 San Francisco and Sydney Face-to-face meetigns. * [css-text-4] Remove 'pre-wrap-auto' from Level 4 As resolved at the 2016 Sydney face-to-face meeting. This 'pre-wrap-auto' had already been removed from Level 3, but was still in level 4. * [css-text] Rephrase 'break-spaces' description This does not change the intended behavior, but the previous phrasing was ambiguous about some situations, and this should clarify. * [css-text] Fix typo in markup
1 parent 8f00a30 commit 995a077

1 file changed

Lines changed: 33 additions & 4 deletions

File tree

css-text/Overview.bs

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,9 @@ Languages and Typesetting</h4>
693693
or visually collapse the character advance widths
694694
of any overflowing spaces
695695
such that they don't take up space in the line.
696+
However, if 'overflow-wrap' is set to ''break-spaces'',
697+
collapsing their advance width is not allowed,
698+
as this would prevent the preserved spaces from wrapping.
696699

697700
Note: Hanging the white space rather than collapsing it
698701
allows users to see the space when selecting or editing text.
@@ -1115,15 +1118,17 @@ Line Breaking Details</h3>
11151118

11161119
<pre class="propdef">
11171120
Name: overflow-wrap, word-wrap
1118-
Value: normal | break-word
1121+
Value: normal | break-word || break-spaces
11191122
Initial: normal
11201123
Inherited: yes
11211124
Canonical order: n/a
11221125
</pre>
11231126

1124-
<p>This property specifies whether the UA may arbitrarily break within a word
1125-
to prevent overflow when an otherwise-unbreakable string is too
1126-
long to fit within the line box. It only has an effect when
1127+
<p>This property specifies whether the UA may break at otherwise disallowed points within a line
1128+
to prevent overflow,
1129+
when an otherwise-unbreakable string is too long to fit within the line box,
1130+
or when sequences of <a>preserved</a> white space would <a>hang</a>.
1131+
It only has an effect when
11271132
'white-space' allows <a>wrapping</a>. Possible values:</p>
11281133

11291134
<dl dfn-for=overflow-wrap dfn-type=value>
@@ -1138,6 +1143,30 @@ Line Breaking Details</h3>
11381143
Shaping characters are still shaped as if the word were not
11391144
broken, and grapheme clusters must stay together as one unit.
11401145
No hyphenation character is inserted at the break point.
1146+
<dt><dfn>break-spaces</dfn></dt>
1147+
<dd>Line breaks are handled as usual,
1148+
except that any sequence of <a>preserved</a> white space
1149+
that would otherwise overflow the line and <a>hang</a> as per <a href="#white-space-phase-2">Trimming and Positioning</a>
1150+
must be broken after the last white space character that would fit the line,
1151+
or after the first white space in the sequence if none would fit,
1152+
or before the first space in the sequence if none would fit and both ''break-word'' and ''break-spaces'' are specified.
1153+
1154+
<p class="note">This last clause is due to the fact that
1155+
'overflow-wrap: break-words'' allows breaks between any two characters
1156+
to avoid overflow</p>
1157+
1158+
<p class="note">This value does not guarantee that there will never be any overflow due to spaces.
1159+
For example, if 'overflow-wrap' is set to ''break-spaces''
1160+
and 'white-space' to ''pre-wrap'',
1161+
and there is a single <a>preserved</a> space at the end of the line,
1162+
and that space overflows,
1163+
the rules of ''break-spaces'' do not introduce any additional line break,
1164+
and that space does overflow and <a>hang</a>.
1165+
If 'overflow-wrap' had been set to ''break-word break-spaces'',
1166+
that space would have been wrapped to the next line,
1167+
unless the line length is so short that even a single space does not fit,
1168+
in which case overflow is unavoidable.</p>
1169+
11411170
</dl>
11421171

11431172
<p><a>Soft wrap opportunities</a> introduced by ''overflow-wrap: break-word''

0 commit comments

Comments
 (0)