Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-text-3] Move break-spaces from overflow-wrap to white-space #2841

Merged
merged 1 commit into from Jun 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 35 additions & 23 deletions css-text-3/Overview.bs
Expand Up @@ -418,7 +418,7 @@ Characters and Letters</h3>

<pre class="propdef">
Name: white-space
Value: normal | pre | nowrap | pre-wrap | pre-line
Value: normal | pre | nowrap | pre-wrap | break-spaces | pre-line
Initial: normal
Applies to: <a>inline boxes</a>
Inherited: yes
Expand Down Expand Up @@ -456,6 +456,20 @@ Characters and Letters</h3>
<dt><dfn>pre-wrap</dfn></dt>
<dd>Like ''pre'', this value preserves <a>white space</a>;
but like ''white-space/normal'', it allows wrapping.
<dt><dfn>break-spaces</dfn></dt>
<dd>The behavior is identical to that of ''white-space/pre-wrap'',
except that:
* Any sequence of <a>preserved</a> white space always takes up space,
including at the end of the line.
* A line breaking opportunity exists after every <a>preserved</a> <a>white space</a> character,
including between white space characters.

As preserved spaces take up space and do not hang,
they affect the box's intrinsic sizes ([=min-content size=] and [=max-content size=]).

<p class="note">This value does not guarantee that there will never be any overflow due to spaces:
for example, if the line length is so short that even a single space does not fit,
overflow is unavoidable.</p>
<dt><dfn>pre-line</dfn></dt>
<dd>Like ''white-space/normal'', this value collapses consecutive spaces and allows wrapping,
but preserves <a>segment breaks</a> in the source as <a>forced line breaks</a>.
Expand All @@ -473,6 +487,7 @@ Characters and Letters</h3>
<th>New Lines</th>
<th>Spaces and Tabs</th>
<th>Text Wrapping</th>
<th>End-of-line spaces</th>
</tr>
</thead>
<tbody>
Expand All @@ -481,30 +496,42 @@ Characters and Letters</h3>
<td>Collapse</td>
<td>Collapse</td>
<td>Wrap</td>
<td>Remove</td>
</tr>
<tr>
<th>''pre''</th>
<td>Preserve</td>
<td>Preserve</td>
<td>No wrap</td>
<td>Preserve</td>
</tr>
<tr>
<th>''nowrap''</th>
<td>Collapse</td>
<td>Collapse</td>
<td>No wrap</td>
<td>Remove</td>
</tr>
<tr>
<th>''pre-wrap''</th>
<td>Preserve</td>
<td>Preserve</td>
<td>Wrap</td>
<td>Collapse or hang</td>
</tr>
<tr>
<th>''break-spaces''</th>
<td>Preserve</td>
<td>Preserve</td>
<td>Wrap</td>
<td>Wrap</td>
</tr>
<tr>
<th>''pre-line''</th>
<td>Preserve</td>
<td>Collapse</td>
<td>Wrap</td>
<td>Remove</td>
</tbody>
</table>

Expand Down Expand Up @@ -623,7 +650,7 @@ Characters and Letters</h3>
invisible, but retains its <a>soft wrap opportunity</a>, if any.)</li>
</ol>
</li>
<li><p>If 'white-space' is set to ''pre'' or ''pre-wrap'',
<li><p>If 'white-space' is set to ''pre'', ''pre-wrap'', or ''break-spaces''
any sequence of spaces is treated as a sequence of non-breaking spaces.
However, a <a>soft wrap opportunity</a> exists at the end of the sequence.

Expand Down Expand Up @@ -669,7 +696,7 @@ Characters and Letters</h3>
<h4 id="line-break-transform">
Segment Break Transformation Rules</h4>

<p>When 'white-space' is ''pre'', ''pre-wrap'', or ''pre-line'',
<p>When 'white-space' is ''pre'', ''pre-wrap'', ''break-spaces'', or ''pre-line'',
<a>segment breaks</a> are not <a>collapsible</a>
and are instead transformed into a preserved line feed (U+000A).

Expand Down Expand Up @@ -730,19 +757,18 @@ Characters and Letters</h3>
(ignoring any intervening <a>inline box</a> boundaries)
is removed.
<li>If spaces or tabs at the end of a line are non-collapsible
but have 'white-space' set to ''pre-wrap'':
<ul>
<li>If 'overflow-wrap' does not specify ''overflow-wrap/break-spaces''
<ul>
<li>If 'white-space' is set to ''pre-wrap'',
the UA must either <a>hang</a> the <a>white space</a>
or visually collapse the character advance widths
of any overflowing spaces
such that they don't take up space in the line.

Note: Hanging the white space rather than collapsing it
allows users to see the space when selecting or editing text.
<li>Otherwise
(i.e. 'overflow-wrap' property specifies ''overflow-wrap/break-spaces''),
<li>If 'white-space' is set to ''break-spaces'',
hanging or collapsing the advance width of spaces at the end of the line is not allowed.
</ul>

</ol>

Expand Down Expand Up @@ -1215,7 +1241,7 @@ Line Breaking Details</h3>

<pre class="propdef">
Name: overflow-wrap, word-wrap
Value: normal | break-word || break-spaces
Value: normal | break-word
Initial: normal
Applies to: <a>inline boxes</a>
Inherited: yes
Expand Down Expand Up @@ -1247,20 +1273,6 @@ Line Breaking Details</h3>
Shaping characters are still shaped as if the word were not
broken, and grapheme clusters must stay together as one unit.
No hyphenation character is inserted at the break point.
<dt><dfn>break-spaces</dfn></dt>
<dd>Line breaks are handled as usual,
except that:
* Any sequence of <a>preserved</a> white space always takes up space,
including at the end of the line.
* A line breaking opportunity exists after every <a>preserved</a> <a>white space</a> character,
including between white space characters.

As preserved spaces take up space and do not hang,
they affect the box's intrinsic sizes ([=min-content size=] and [=max-content size=]).

<p class="note">This value does not guarantee that there will never be any overflow due to spaces:
for example, if the line length is so short that even a single space does not fit,
overflow is unavoidable.</p>

</dl>

Expand Down