Skip to content

[css-text-3] Spaces don't hang when break-spaces is specified #2612

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

Merged
merged 3 commits into from
May 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions css-text-3/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -724,17 +724,20 @@ 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''
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.
However, if 'overflow-wrap' is set to ''break-spaces'',
collapsing their advance width is not allowed,
as this would prevent the preserved spaces from wrapping.

Note: Hanging the white space rather than collapsing it
allows users to see the space when selecting or editing text.
but have 'white-space' set to ''pre-wrap'':
<ul>
<li>If 'overflow-wrap' does not specify ''overflow-wrap/break-spaces''
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''),
hanging or collapsing the advance width of spaces at the end of the line is not allowed.

</ol>

Issue: Add example of hanging white space + same example right-aligned.
Expand Down Expand Up @@ -1241,19 +1244,17 @@ Line Breaking Details</h3>
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
that would otherwise overflow the line and <a>hang</a> as per <a href="#white-space-phase-2">Trimming and Positioning</a>
must be broken after the last white space character that would fit the line,
or after the first white space in the sequence if none would fit.

<p class="note">This value does not guarantee that there will never be any overflow due to spaces.
For example, if 'overflow-wrap' is set to ''break-spaces''
and 'white-space' to ''pre-wrap'',
and there is a single <a>preserved</a> space at the end of the line,
and that space overflows,
the rules of ''break-spaces'' do not introduce any additional line break,
and that space does overflow and <a>hang</a>.
Also, if the line length is so short that even a single space does not fit,
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