word-break: break-all shouldn't create breaks between punctuation
Categories
(Core :: Layout: Text and Fonts, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: fantasai.bugs, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
'word-break: break-all' is not supposed to affect breaking between/around punctuation, only between pairs of letters (or symbols that behave like letters for line breaking). Testcase: http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cdiv%20style%3D%22word-break%3A%20break-all%20%3B%20font-size%3A%20200px%22%3EABC)%3C%2Fdiv%3E Spec: https://www.w3.org/TR/css-text-3/#break-all “In addition to ‘normal’ soft wrap opportunities, lines may break between any two **letters** (except where forbidden by the ‘line-break’ property). Hyphenation is not applied. This option is used mostly in a context where the text is predominantly using CJK characters with few non-CJK excerpts and it is desired that the text be better distributed on each line.”
Updated•6 years ago
|
Updated•5 years ago
|
Copying over metadata from duplicate bug 1472598. Xidorn points out that we might want to implement `line-break: anywhere` as part of this, to make sure that the use case has a solution.
![]() |
||
Comment 3•5 years ago
|
||
Probably related to Bug 1272059 Using the test case http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cdiv%20style%3D%22word-break%3A%20break-all%20%3B%20font-size%3A%20200px%22%3EABC)%3C%2Fdiv%3E Firefox, Safari: They break at the punctuation. Chrome: It breaks at the character before the punctuation.
Koji is reporting that Chrome is running into compat problems because of this bug, fwiw. Any plans for fixing yet?
Comment 5•4 years ago
|
||
(In reply to fantasai from comment #4)
Koji is reporting that Chrome is running into compat problems because of this bug, fwiw. Any plans for fixing yet?
Comment 6•4 years ago
|
||
Err, I meant to reply:
Jonathan has a better handle on all our line-breaking stuff. I'm happy to give it a shot at some point though.
Assignee | ||
Comment 7•4 years ago
|
||
It looks like our current implementation of word-break:break-all is rather too naïve: it essentially just treats every character as a potential break position -- e.g. see https://searchfox.org/mozilla-central/rev/00c0d068ece99717bea7475f7dc07e61f7f35984/intl/lwbrk/LineBreaker.cpp#901-902. (Maybe an older spec said something more like that?)
Anyhow, as currently spec'd, break-all doesn't simply mean "break anywhere"; it's defined in terms of revised line-break categories for certain classes of character. We should probably revise the impl in LineBreaker.cpp to better match the spec.
I've pushed a try job at https://treeherder.mozilla.org/#/jobs?repo=try&revision=012fd97eff0766a3add5c137777a867fe4db04e6 with an experimental patch; let's see what shakes out. Most likely there'll be a few oranges on the tree...
Assignee | ||
Comment 8•4 years ago
|
||
Turns out there's an existing web-platform reftest (word-break-break-all-020.html) for this -- it's currently marked as failing, but if we fix break-all to follow the spec then we can remove that annotation.
Assignee | ||
Comment 9•4 years ago
|
||
Comment 10•4 years ago
|
||
Nice! It would've taken me quite a bit to come up with that patch :-)
Reporter | ||
Comment 11•4 years ago
|
||
@Emilio You could map the old behavior to line-break: anywhere
? :)
@jfkthame Thank you~
Comment 12•4 years ago
|
||
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a93501fc7922 Reimplement word-break:break-all to better match the CSS Text spec. r=masayuki
Comment 13•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Updated•4 years ago
|
Description
•