word-wrap: break-word implementation
Categories
(Core :: Layout: Text and Fonts, enhancement)
Tracking
()
People
(Reporter: majuki, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-needed)
Attachments
(2 files)
Comment 1•15 years ago
|
||
Comment 5•15 years ago
|
||
Comment 6•15 years ago
|
||
Comment 8•15 years ago
|
||
Comment 9•8 years ago
|
||
Comment 10•8 years ago
|
||
Comment 11•8 years ago
|
||
Comment 12•8 years ago
|
||
Updated•8 years ago
|
Comment 13•7 years ago
|
||
Nightly(v68) now supports this property.
Comment 14•7 years ago
|
||
Emilio, is this bug fixed by bug 1296042? Or should it be marked invalid? Or is there still an issue here?
Comment 15•7 years ago
|
||
word-wrap: break-word has been implemented since forever (bug 99457), and works the same everywhere.
This bug is more of a change / feature request, if I understand correctly, to change the implementation minimize the amount of whitespace in a single paragraph.
I assume comment 13 meant word-break: break-word, which is bug 1296042, but that's not relevant here.
Any sort of automatic breaking like that would need to be at least two-pass, IIUC, so I suspect it's a no-go, but there's other proposal about setting the minimum width of the word to break or such that conceptually could be implemented.
Jonathan may be a better candidate to decide what to do with this bug.
Comment 16•7 years ago
|
||
Looking all the way back to the original report in comment 0, I think the request is a reasonable one, but it's unclear to me exactly how this should be controlled in CSS, let alone implemented in the browser.
Given that the current behavior appears to be interoperable across all the major browsers, we should not simply change the existing behavior of overflow-wrap:break-word, even though the behavior suggested here looks like it would often be preferable.
So while there are some interesting ideas in the comments above, it's unclear how best to move forward. What I think needs to happen is for someone to design a specific proposal for a new/better behavior, and how to express it in CSS, and get CSS working group buy-in.
fantasai may have thoughts on whether/how to include it in CSS
Comment 18•7 years ago
|
||
UAs are allowed to use whatever algorithm they want for deciding which break point to take: CSS only defines where breaks are allowed, not which ones are taken. It would be perfectly spec-conformant to improve the results here, and this is indeed one of the reasons why we're not prescriptive about the line-breaking algorithm. We want UAs to do better than they have historically.
That said, there is some concern about what the Web-compat impact would be. I do suspect most of the time when pages are sensitive to which break is taken (rather than just whether or not the text breaks), it's when laying out atomic inlines--but that's not really an issue here because we're breaking text specifically. So it might be worth experimenting with better line-breaking in these cases without introducing new syntax, to see if we can just do it.
If a switch is necessary due to Web-compat, text-wrap in Text Level 4 is introducing a keyword to opt into "prettier, but potentially slower and different" line-breaking, and that can be used as an opt-in.
Updated•3 years ago
|
Description
•