Bug 41103 - Consider matching either Firefox or IE better in the characters that allow a linewrap
Summary: Consider matching either Firefox or IE better in the characters that allow a ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 20677 27074 27195
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-23 14:44 PDT by Tab Atkins
Modified: 2012-08-23 15:42 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tab Atkins 2010-06-23 14:44:01 PDT
Firefox 3.6 (and possibly earlier) treats the forward slash "/" as creating a linebreak opportunity for the linewrap algorithm.  IE8 (and possibly earlier) treats the open square bracket "[" as creating a linebreak opportunity for the linewrap algorithm.  Webkit does neither.  This causes the PCWorld page at http://www.pcworld.com/article/168658/seven_reasons_microsofts_profits_are_tanking.html to break, as a comment at the bottom of the page contains a very long line with no spaces, but several forward slashes and square brackets.

We should match either Firefox or IE here, or perhaps both, in their linebreak-opportunity seeking.

Minimal test case:
data:text/html,%3C!DOCTYPE%20html%3E%3Cdiv%20style%3D%22width%3A%20800px%3B%20margin%3A%200%20auto%3B%22%3E%3Cdiv%20style%3D%22float%3A%20left%3B%20width%3A%20600px%3B%22%3Efoooooooooooooooooooooo%2Fooooooooooooooooooooooooooooo%2Foooooooooooooooooooooooooooo%2Fooooooooooooooooooooooooooo%2Fooooooooooooooooooooooo%3C%2Fdiv%3E%3Cdiv%20style%3D%22float%3A%20right%3B%20width%3A%20200px%3B%20height%3A%20600px%3B%20background%3A%20gray%3B%22%3E%3C%2Fdiv%3E%3C%2Fdiv%3E

Expected Result: The long line breaks before the second and fourth forward slashes, and doesn't stretch the left float.  (This works as expected in Firefox.  Replace the / with [ for it to work as expected in IE.)
Actual Result: The long line doesn't break at all, stretching the left float underneath the right float and off the side of the monitor for most people.
Comment 1 Aryeh Gregor 2010-06-23 15:30:34 PDT
This is covered by Unicode TR14:

http://unicode.org/reports/tr14/

I don't think any browser fully implements that (why not?).  It appears to say that breaks are prohibited before class SY, which contains U+002F SOLIDUS (LB13), and prohibited after SY if it's followed by a digit (LB25), but otherwise permitted (LB31).  Breaks between alphanumerics (AL and NU) and opening punctuation like [ (OP) are prohibited by LB30, contradicting IE's behavior.

It would be cool if the full algorithm were implemented.  It contains a lot of useful advice, like "don't break before '!', even after a space" (common in French).  It doesn't seem complicated at all to implement -- does it have major problems?
Comment 2 Eric Seidel (no email) 2010-10-20 10:39:44 PDT
bug 25638 may also be related.
Comment 3 Eric Seidel (no email) 2010-10-20 10:40:45 PDT
Simple reduction:
<div style="width: 10px">
a/a/a/a/a/a/a/a/a/a/a/a/a/a/a
</div>
Comment 4 Eric Seidel (no email) 2010-10-20 10:41:13 PDT
Several dups in Chromium:
http://code.google.com/p/chromium/issues/detail?id=57052