See the attached test case. This bug affects text areas (which use word-wrap: break-word).
Created attachment 13107 [details] Test case
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).
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.
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").
Comment on attachment 13157 [details] Use the inaccurate text measurement only as a lower bound r=me
Landed in r19621.