Closed Bug 1358019 Opened 7 years ago Closed 5 years ago

word-break: break-all shouldn't create breaks between punctuation


(Core :: Layout: Text and Fonts, defect, P3)




Tracking Status
firefox67 --- fixed


(Reporter: fantasai.bugs, Assigned: jfkthame)


(Blocks 1 open bug)



(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).

“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.”
Priority: -- → P3
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.
Blocks: css-text-3
Depends on: 1011369
Attached image firefox, safari, chrome
Probably related to Bug 1272059 

Using the test case!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?

(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?

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.

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 (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 with an experimental patch; let's see what shakes out. Most likely there'll be a few oranges on the tree...

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.

Nice! It would've taken me quite a bit to come up with that patch :-)

@Emilio You could map the old behavior to line-break: anywhere? :)
@jfkthame Thank you~

Pushed by
Reimplement word-break:break-all to better match the CSS Text spec. r=masayuki
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Assignee: nobody → jfkthame
See Also: → 1531715
Regressions: 1554998
You need to log in before you can comment on or make changes to this bug.