WebKit doesn't seem to break lines at text nodes with only ZWSPs surrounded by inline elements.
Steps to reproduce:
1. Create a div element (specify a width if you want)
2. Create two spans that will each fit in the div, but not next to each other and contain no spaces.
3. Separate these spans with a ZWSP (​)
No line-break is inserted, they appear in the same line. The text runs out of the box.
The two spans appear in separate lines.
Build Date & Platform:
08 January 2011, Mac OS X 10.6.6
See the attachment for a small page reproducing the bug.
Created attachment 78782 [details]
A small page that reproduces the bug
Created attachment 81573 [details]
Looks reasonable to me.
What do other browsers do? what spec covers this? Please mention such in the ChangeLog. Otherwise this looks ready to land.
Regardless of whether this is a desirable change, you can’t patch findNextLineBreak() and not make the corresponding change to RenderText::trimmedPrefWidths() or you’d incorrect min preferred widths.
This isn't covered by any of the html specifications as far as I can tell. It is seems inconsistent to have different line breaking behavior in text and between inline elements though.
Both Gecko and IE wrap inline elements on zwsp.
mitz: Thanks for pointing that out, I was unsure whether I should change that and erred (incorrectly) on the side of caution. Are there any other things I need to look out for?
Comment on attachment 81573 [details]
Marking patch as obsolete, will upload a new one addressing mitz's comments.
As well as zero-width spaces, maybe also consider splitting on other space types (hair, thin, em, en).
Although the html 4 spec only recognises ZWSP as white-space (see http://www.w3.org/TR/html401/struct/text.html#h-9.1 ), handling the other types of space similarly seems harmless and would match the behaviour of Firefox and IE and would also make for consistency between the handling of space between inline elements and text (text already breaks on all of these).