Re: [csswg-drafts] [css-text-3] Note about overflow-wrap: break-spaces seems wrong

In the absence of `break-spaces`, `break-word` is expected not to break before the first space of the preserved sequence at the end of the line, as it is supposed to hang (or to be collapsed, but that's already ruled out in this case, see below). If we remove the bit you suggest we remove, then what cause the requirement to change from "hang" to "break before the first space"?

We have:
* in https://drafts.csswg.org/css-text-3/#white-space-phase-1
  > If white-space is set to pre or pre-wrap, any sequence of spaces is treated as a sequence of non-breaking spaces. However, a soft wrap opportunity exists at the end of the sequence. 
* in https://drafts.csswg.org/css-text-3/#white-space-phase-2
  > 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 hang the white space 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. 

If we removed the thing you said we should remove, I am worried that the following interpretation becomes either the only possible one, or a possible ambiguity:

* `white-space` is `pre-wrap`, therefore per 4.1.1's second bullet sequences of white spaces are turned into sequences of  of non-breaking spaces with a wrap opportunity at the end, but not elsewhere (and specifically, not at the beginning).
* `white-space` is `pre-wrap` and `overflow-wrap` has `break-spaces`, so per 4.1.3 point 4, I cannot collapse the end-of-line preserved spaces, and must instead hang them.
* `white-space` is `pre-wrap` and `overflow-wrap` has `break-spaces`, so per the definition of `break-spaces`, in addition to soft wrap opportunity at the end of the sequence given by 4.1.1, there are also opportunities between each of the spaces, but since the `break-spaces` no longer (per your suggestion) explicitly allows breaks before the first space in the preserved sequence that space character should just be hanging, (as per 4.1.3.), and we break after that space (as per the definition of `break-spaces`).

With all that said, I agree that this whole thing is hard to follow, and that being sure of exactly what behavior is expected by the interaction of this various parts is quite hard, and also that the note itself may not be terribly well phrased.

So I support rephrasing either the normative text, or the note, or both, but I don't think the simple removal you suggest actually works out well.


-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2003#issuecomment-346241769 using your GitHub account

Received on Wednesday, 22 November 2017 04:41:47 UTC