RESOLVED FIXED 12726
REGRESSION (r12073): Text wraps in the middle of a word instead of wrapping at the space before the word
https://bugs.webkit.org/show_bug.cgi?id=12726
Summary REGRESSION (r12073): Text wraps in the middle of a word instead of wrapping a...
mitz
Reported 2007-02-10 11:04:50 PST
See the attached test case. This bug affects text areas (which use word-wrap: break-word).
Attachments
Test case (453 bytes, text/html)
2007-02-10 11:05 PST, mitz
no flags
Don't measure a run by adding up the widths of individual characters (38.19 KB, patch)
2007-02-10 11:29 PST, mitz
no flags
Use the inaccurate text measurement only as a lower bound (44.18 KB, patch)
2007-02-13 16:31 PST, mitz
hyatt: review+
mitz
Comment 1 2007-02-10 11:05:25 PST
Created attachment 13107 [details] Test case
mitz
Comment 2 2007-02-10 11:29:50 PST
Created attachment 13108 [details] Don't measure a run by adding up the widths of individual characters When word-wrap is break-word, the new code is O(n^2) in the length of the first word on the line (for autowrap) or the length of the entire line (for PRE).
mitz
Comment 3 2007-02-10 15:23:32 PST
Comment on attachment 13108 [details] Don't measure a run by adding up the widths of individual characters I'm going to think more about this and try to come up with a better-behaved solution.
mitz
Comment 4 2007-02-13 16:31:09 PST
Created attachment 13157 [details] Use the inaccurate text measurement only as a lower bound This patch keeps the current mechanism that adds up single characters' widths, but once the total width overflows the line's width, it starts measuring everything as a single run. Looking at r12073, I realized that this was actually what the code was doing before that patch (modulo the bugs fixed since then). I also made things a little more efficient by not measuring or computing things that didn't change or that you no longer care about. I think this approach is better than the alternative of not measuring anything until you hit the first word boundary, since that can be proportional to the length of the entire text object, whereas the rounding error is proportional to the length of a single line. (This might make a difference when you're editing the first line of a very long "word").
Dave Hyatt
Comment 5 2007-02-13 17:28:17 PST
Comment on attachment 13157 [details] Use the inaccurate text measurement only as a lower bound r=me
Sam Weinig
Comment 6 2007-02-14 06:23:30 PST
Landed in r19621.
Note You need to log in before you can comment on or make changes to this bug.