Bug 56269 - Markup interferes with soft hyphen line-breaking
Summary: Markup interferes with soft hyphen line-breaking
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL: http://dl.dropbox.com/u/4619191/webki...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-13 13:36 PDT by Peter Bright
Modified: 2011-09-06 18:43 PDT (History)
3 users (show)

See Also:


Attachments
Demonstration (56 bytes, text/plain)
2011-03-13 13:36 PDT, Peter Bright
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Bright 2011-03-13 13:36:18 PDT
Created attachment 85620 [details]
Demonstration

If a soft hyphen is the last character in an element, it seems that is no longer considered to be a line-breaking opportunity. The linked demonstration should permit breaks between "break" and "me", but it appears that the soft hyphen gets suppressed because the line break should occur between two spans, rather than internal to one of them.

Given that WebKit does, in other circumstances, regard the soft hyphen as a line-breaking opportunity, I feel it should do so in this case too (though from what I can tell, the behaviour of hyphenation is not usefully defined, so perhaps this is an "enhancement" rather than a bug). Hyphenation should surely be driven by the "textual" content of a document, and not the logical (DOM) structure; that there are intervening span tags should not preclude the insertion of a line-break and visible hyphen in this case.

Firefox 4RC and Internet Explorer 9 RTM both disagree with WebKit's interpretation and both allow line-breaking at the soft hyphens. Opera 11.01 is consistent with WebKit.

Safari 5.0.4, Chrome 11.0.696.3 dev, on 64-bit Windows 7 with Service Pack 1, and Safari 5.0.4 on Mac OS X 10.6.6, all demonstrate the failure to line-break.
Comment 1 mitz 2011-03-14 10:42:38 PDT
This looks like a special case of bug 17427.
Comment 2 Peter Bright 2011-03-14 10:49:00 PDT
Ah yes, I did not find that in a search. But yes, it looks essentially the same. The only nuance is that since the ­ is getting suppressed, there isn't actually a line-breaking opportunity any more. "Break?Me" can break because of the punctuation; "Break­Me" can break because of the soft hyphen. But the soft hyphen is getting removed, leaving "BreakMe", which is not eligible for a break anyway.

At least, I think the soft hyphen is getting removed--it no longer appears in innerHTML etc.. I wonder if that is a separate (buggy?) issue; not rendering the ­ is one thing, removing it from the document entirely seems quite another.
Comment 3 Peter Bright 2011-03-19 00:41:35 PDT
Oh they don't even have to be separated by elements. If you create an element with multiple text nodes, a soft hyphen at the end of one text node is no longer a breaking point.

If you normalize() the element (to fuse adjacent text nodes) then the hyphens work.

See: http://dl.dropbox.com/u/4619191/webkit-soft-hyphens.html
The top box has separate text nodes, the bottom box normalizes. In IE9 and Firefox 4, both boxes have a linebreak. In WebKit, only the bottom one does.