Reviewed by Hyatt
[WebKit-https.git] / WebCore / khtml / rendering / bidi.cpp
index 2babdfc05d5fd3bf2188cb37478651a33d34c866..c0d7f0a717328de246f9ca11c49d3c2a2c909816 100644 (file)
@@ -2059,9 +2059,13 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi
                     }
         
                     if (o->style()->whiteSpace() == NORMAL) {
-                        if (w + tmpW > width) {
-                            if (o->style()->khtmlLineBreak() == AFTER_WHITE_SPACE)
+                        int charWidth = o->style()->khtmlLineBreak() == AFTER_WHITE_SPACE ? t->width(pos, 1, f) : 0;
+                        if (w + tmpW + charWidth > width) {
+                            if (o->style()->khtmlLineBreak() == AFTER_WHITE_SPACE) {
+                                lBreak.obj = o;
+                                lBreak.pos = pos;
                                 skipWhitespace(lBreak, bidi);
+                            }
                             goto end; // Didn't fit. Jump to the end.
                         }
                         else if (pos > 1 && str[pos-1].unicode() == SOFT_HYPHEN)