Re: [css-text] white-space: pre-wrap

Hi,

Sorry for the late answer.

> On 25 Aug 2015, at 22:59, Koji Ishii <kojiishi@gmail.com> wrote:
> 
> I was re-reading NY F2F minutes[1] on the topic and came up with a few questions. Clarifications appreciated.
> 
> 1. There's a resolution saying:
>   RESOLVED: pre-wrap preserves all spaces visibly and allows
>             wrapping before and after every space (to go into level
>             3 and mark as at risk)
> but this is not in the ED yet, am I correct? I remember I saw some PR from Florian (thank you for that) and would like to confirm this isn't done yet.

It was this PR, https://github.com/w3c/csswg-drafts/pull/27 <https://github.com/w3c/csswg-drafts/pull/27>
As far as I am concerned, the PR does everything the resolution asked for, so I consider it done. Do you think I missed something?

> 2. The resolved behavior would give you a bit strange experience if a word ends at the right margin, then you'd see the space character on the beginning of the next line. Are we sure we want this behavior?

I think so. The author asked for preserve and wrap, that's what he gets. For "smart" perserve and wrap, allowing UAs to decide what to do about spaces left at the end of the line, you can use the pre-wrap-auto value instead.

And if the author wants to be explicit (rather than automagic) about removing spaces at the end of the line, there's the pre-wrap-trim value to be added in level 4 (I'll send a pull request about this shortly).

> 3. I saw the discussion saying:
>   Similar to Word behavior.
>   So IE probably has the best behavior but isn't spec compliant.
>   We should fix it.
> but Word does not wrap at spaces, it just overflows to the right margin, so the same as Chrome/Safari.

"Similar to word" is not what we resolved on for pre-wrap. We have a simpler and less magical behavior. The value that allows UAs to match platform conventions and do smart things, such as behaving like word, or going the OS X behavior is pre-wrap-auto, not pre-wrap.

> 4. In IE, as far as I looked at it, repetitive space characters cause wrap, but not by allowing break before and after space characters. It looks like "word + one or more spaces" is treated as unbreakable. The resolution above looks like different from IE, different from Word, and different from any other implementations.

Right. Every browser today has different behavior, and we resolved to allow them to keep these behaviors under pre-wrap-auto.

> An old bug in Chromium[2] got my attention recently, but the resolution does not look to give the desired behavior to me. Could someone clarify?

Implementing pre-wrap according to the spec as it is now would fix this bug. The current chrome behavior, if google likes it, can be preserved, but it should be called pre-wrap-auto.

> [1] https://lists.w3.org/Archives/Public/www-style/2015May/0281.html <https://lists.w3.org/Archives/Public/www-style/2015May/0281.html>
> [2] http://crbug.com/76113 <http://crbug.com/76113>
> 
> /koji

Received on Friday, 11 September 2015 06:49:11 UTC