You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-text] line-break: anywhere but normal breaking at spaces #3561
We added line-break: anywhere, but resolved to break at preserved spaces too.
Looking at requests from authors (crbug.com/720205 and an author page linked from it), what author wants is Gecko/WebKit behavior, which is break before/after any punctuation, but not at preserved spaces.
I understand some members do want to break at preserved spaces, and but including it breaks the original requests.
There's a possibility to change break-all to match to Gecko/WebKit. Since the two impls do differently from the spec for a long time that I'm seeing some Japanese sites stopped using break-all these days. However, some major sites such as Yahoo! Japan are still using it, so I'm in a mixed feeling about this.
If we were going to take this route, then the new value in this request is not needed, but a new value for the original CJK purpose is nice to have.
Hi Koji, I'm a little confused exactly what you're requesting here. As long as break-spaces is not specified, a space at the end of the line will not take up any space. So there will not be any break that wraps a space to the beginning of a line. Are you talking about a different kind of space?
Technically, when spaces hang (default behavior) it doesn't matter whether there is a break opportunity or not around them, they'll still "fit" on the line so we won't break before them even if there is an opportunity... So I think either way you get the behavior you want for line-break: anywhere (except when break-spaces is specified of course).
Oh, I see, I was under impression that only non-breakable sequences can hang, since hanging is a type of emergency operations for CJK to avoid expansions or lagged lines, but probably not for other writing systems.
I'm good with the interpretation, @frivoal great if you can confirm the text has nothing to do unless break-spaces is specified.
As far I understand it, the new 'break-spaces' value already provides soft wrap opportunities around preserved spaces. What does this combination with line-break: anywhere provide ?
As far I understand it, the new 'break-spaces' value already provides soft wrap opportunities around preserved spaces. What does this combination with line-break: anywhere provide ?
line-break: anywhere isn't just about spaces, but on the topic of spaces, it changes one thing of the behavior of white-space:break-spaces when used together: white-space:break-spaces introduces break opportunities after every space. That means that between the last letter of a word and the first space, there isn't one. If you addline-break: anywhere, then there is also a break opportunity there.
Basically yes, and I'm all for making the spec clearer if it isn't now, but to me the way you describe it more confusing than what's in the spec (even though I now understand what you mean):
* `line-break: anywhere` changes nothing about breaking before/after spaces.
well, it changes nothings about breaking before or after preserved spaces when there are no preserved spaces. Other kinds of spaces (nbsp, narrow non breaking spaces, etc) do get break opportunities. Also, line-break is about breaking opportunities, not forced breaks, so it has no effect when you don't need to wrap at all, as is the case when preserved spaces hang (pre-wrap), or when wrapping is disabled entirely (pre, nowrap).
Maybe we can keep the normative prose as it is, and add a note like:
Note: anywhere only allows preserved spaces at the end of the line to be wrapped to the next line when white-space is break-spaces, because in other cases:
preserved spaces at the end/start of the line are discarded (normal, pre-line)
wrapping is forbidden altoghether (nowrap, pre)
wrapping spaces is unecessary as they hang (pre-wrap).
When it does have an effect on preserved spaces, with break-spaces, it allows breaking before the first of a sequence of preserved spaces, which break-spaces does not do on its own.
line-break: anywhere isn't just about spaces, but on the topic of spaces, it changes one thing of the behavior of white-space:break-spaces when used together: white-space:break-spaces introduces break opportunities after every space. That means that between the last letter of a word and the first space, there isn't one. If you addline-break: anywhere, then there is also a break opportunity there.
I see; although the same happens when combining white-space: break-spaces and overflow-wrap: break-word, right ? In that case there is also a break opportunity between the last letter of a word and the first space. Are these two combinations totally equivalent ?
I see; although the same happens when combining white-space: break-spaces and overflow-wrap: break-word, right ? In that case there is also a break opportunity between the last letter of a word and the first space. Are these two combinations totally equivalent ?
Yes, it is similar, but no, it is not totally equivalent: overflow-wrap: break-word or overflow-wrap: anywhere (together with white-space:break-spaces) will add a wrapping opportunity between the last letter of the word and the first space after it if there's no other wrapping opportunity in the line.
Activity
kojiishi commentedon Jan 28, 2019
There's a possibility to change
break-allto match to Gecko/WebKit. Since the two impls do differently from the spec for a long time that I'm seeing some Japanese sites stopped usingbreak-allthese days. However, some major sites such as Yahoo! Japan are still using it, so I'm in a mixed feeling about this.If we were going to take this route, then the new value in this request is not needed, but a new value for the original CJK purpose is nice to have.
cc @upsuper @litherum
kojiishi commentedon Jan 28, 2019
A test showing cases @jsbin
IIUC what authors want at crbug.com/720205 is Gecko/WebKit behavior on these two cases, but neither value of the spec provide it.
fantasai commentedon Jan 29, 2019
Hi Koji, I'm a little confused exactly what you're requesting here. As long as break-spaces is not specified, a space at the end of the line will not take up any space. So there will not be any break that wraps a space to the beginning of a line. Are you talking about a different kind of space?
kojiishi commentedon Jan 29, 2019
Thanks, that's great. Currently the
line-break: anywherestates that:Should "around preserved spaces" be applied only when
break-spacesis also specified?fantasai commentedon Jan 29, 2019
@kojiishi Hm, I'm not sure.
Technically, when spaces hang (default behavior) it doesn't matter whether there is a break opportunity or not around them, they'll still "fit" on the line so we won't break before them even if there is an opportunity... So I think either way you get the behavior you want for
line-break: anywhere(except whenbreak-spacesis specified of course).cc @frivoal
kojiishi commentedon Jan 30, 2019
Oh, I see, I was under impression that only non-breakable sequences can hang, since hanging is a type of emergency operations for CJK to avoid expansions or lagged lines, but probably not for other writing systems.
I'm good with the interpretation, @frivoal great if you can confirm the text has nothing to do unless
break-spacesis specified.frivoal commentedon Jan 30, 2019
I confirm. If
white-spaceis:no-wraporpre, then we don't break anywaynormalorpre-line, there's no preserved space at the end of the line, soline-break: anywherecan't add soft wrap opportunities around thempre-wrap, there are preserved spaces at the end of the line, but they hang, so soft wrap opportunities don't do anythingbreak-spaces, thenline-break: anywheredoes add soft wrap opportunities around them.So I think the spec is fine as is, except if we want a note to clarify the
pre-wrapcase.kojiishi commentedon Jan 30, 2019
Thank you for the confirmation. If a definition in the spec doesn't do anything, isn't it better to not to have it?
If you want that effect only when
break-spacesis specified, it is helpful if we can write so.javifernandez commentedon Feb 5, 2019
As far I understand it, the new 'break-spaces' value already provides soft wrap opportunities around preserved spaces. What does this combination with line-break: anywhere provide ?
https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces
frivoal commentedon Feb 6, 2019
line-break: anywhereisn't just about spaces, but on the topic of spaces, it changes one thing of the behavior ofwhite-space:break-spaceswhen used together:white-space:break-spacesintroduces break opportunities after every space. That means that between the last letter of a word and the first space, there isn't one. If you addline-break: anywhere, then there is also a break opportunity there.kojiishi commentedon Feb 6, 2019
So, IIUC:
line-break: anywherechanges nothing about breaking before/after spaces.white-space: break-spacedisallows hanging spaces, and adds break opportunities after every spaces, including between spaces.white-space: break-spacewhen used withline-break: anywhereadds break opportunities before spaces too.Is this correct?
If so, it'd be very helpful if the spec has these conditions more straight.
frivoal commentedon Feb 6, 2019
Basically yes, and I'm all for making the spec clearer if it isn't now, but to me the way you describe it more confusing than what's in the spec (even though I now understand what you mean):
well, it changes nothings about breaking before or after preserved spaces when there are no preserved spaces. Other kinds of spaces (nbsp, narrow non breaking spaces, etc) do get break opportunities. Also, line-break is about breaking opportunities, not forced breaks, so it has no effect when you don't need to wrap at all, as is the case when preserved spaces hang (pre-wrap), or when wrapping is disabled entirely (pre, nowrap).
Maybe we can keep the normative prose as it is, and add a note like:
javifernandez commentedon Feb 11, 2019
I see; although the same happens when combining white-space: break-spaces and overflow-wrap: break-word, right ? In that case there is also a break opportunity between the last letter of a word and the first space. Are these two combinations totally equivalent ?
frivoal commentedon Apr 23, 2019
Yes, it is similar, but no, it is not totally equivalent:
overflow-wrap: break-wordoroverflow-wrap: anywhere(together withwhite-space:break-spaces) will add a wrapping opportunity between the last letter of the word and the first space after it if there's no other wrapping opportunity in the line.frivoal commentedon Sep 27, 2019
tested by line-break-anywhere-005.html