Re: [csswg-drafts] [css-text][css-sizing] When to/not to include preserved trailing spaces (#3440)

> all impls do not hang them for pre

We're keeping that. This change only affects `pre-wrap`. For `pre`, nothing changes: we do not hang.

> you want to allow both hanging and not-hanging for end-of-spaces with forced breaks?

Kind of, but the choice is not up to the UA, it depends on what fits the line or not.

The key point here is that:

1. Before unforced breaks, we require hanging in all cases (same as "force-end" for punctuation). (same in #3868 and #4095)

2. For #4095, before forced breaks, we require "conditional hanging", which is the type of hanging used by "allow-end" for punctuation: hang if it wouldn't fit, don't hang if it does. #3868 was different, and never hangs it before forced break, even if it doesn't fit.

It will give the behavior you wanted when using pre-wrap on a paragraph with two spaces after period: the end-of-line space for spaces in the middle of the paragraph will hang, and therefore justification will work properly.

It also means, that if you have a single line, with a forced break at the end, and preserved spaces at the start and end, both the start spaces and the end spaces are taken into account for alignment. See example 6.
![Screen Shot 2019-07-20 at 09 42 43](https://user-images.githubusercontent.com/113268/61575907-d088ef80-aad2-11e9-8b8e-8c82723e6ad5.png)

This will give the correct result in https://bugs.chromium.org/p/chromium/issues/detail?id=453830 

All that is the same in #3868 a #4095. But here is the difference:
If there are more spaces than can fit the line before a forced break, those than don't fit hang. For example, if we have `<div>a_b__</div>` with `white-space:pre-wrap` and a line length that will fit only 4 characters, #3868 will result in
```
|a_  |
|b__ |
```
but #4095 will result in
```
|a_b_|_
```

That seems better because:
* #4095 is more web compatible: #3868 would result in content that currently fits in one line to start taking two some times
* If you consider editing, and you add a "c" at the end of the example above, both #3868 and #4095 will result in:
    ```
    |a_b_|_
    |c   |
    ```
   For #4095, that's not surprising for the user, as the previous text doesn't change, but for #3868, it is surprising, as the wrapping of the previous text changes.


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

Received on Friday, 26 July 2019 14:53:04 UTC