LayoutTests:
Reviewed by Darin.
- test for http://bugs.webkit.org/show_bug.cgi?id=13156
REGRESSION (r19621): Pasting breakable content where wrapped line is too long to fit in a textarea fails to draw a horizontal scrollbar
* fast/text/midword-break-after-breakable-char-expected.checksum: Added.
* fast/text/midword-break-after-breakable-char-expected.png: Added.
* fast/text/midword-break-after-breakable-char-expected.txt: Added.
* fast/text/midword-break-after-breakable-char.html: Added.
WebCore:
Reviewed by Darin.
- fix http://bugs.webkit.org/show_bug.cgi?id=13156
REGRESSION (r19621): Pasting breakable content where wrapped line is too long to fit in a textarea fails to draw a horizontal scrollbar
Test: fast/text/midword-break-after-breakable-char.html
Breaking in the middle of the word
is allowed only if no breaking opportunity between words has occurred yet. The
first position on the line should not be considered "between words" even if
it is a breaking opportunity.
* rendering/bidi.cpp:
(WebCore::RenderBlock::findNextLineBreak): Changed according to the above. Also
cleaned up a couple of lines.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20479 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index d78dc29..444d855 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -2095,6 +2095,7 @@
RenderObject *last = o;
RenderObject *previous = o;
int pos = start.pos;
+ bool atStart = true;
bool prevLineBrokeCleanly = previousLineBrokeCleanly;
previousLineBrokeCleanly = false;
@@ -2308,11 +2309,11 @@
currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c == noBreakSpace);
if (breakWords && !midWordBreak) {
- wrapW += t->width(pos, 1, f, w+wrapW);
+ wrapW += t->width(pos, 1, f, w + wrapW);
midWordBreak = w + wrapW > width;
}
- bool betweenWords = c == '\n' || (currWS != PRE && isBreakable(str, pos, strlen, nextBreakable, breakNBSP));
+ bool betweenWords = c == '\n' || (currWS != PRE && !atStart && isBreakable(str, pos, strlen, nextBreakable, breakNBSP));
if (betweenWords || midWordBreak) {
bool stoppedIgnoringSpaces = false;
@@ -2484,6 +2485,7 @@
pos++;
len--;
+ atStart = false;
}
// IMPORTANT: pos is > length here!
@@ -2513,7 +2515,7 @@
checkForBreak = true;
}
bool willFitOnLine = (w + tmpW <= width);
- bool canPlaceOnLine = willFitOnLine || !willFitOnLine && !autoWrapWasEverTrueOnLine;
+ bool canPlaceOnLine = willFitOnLine || !autoWrapWasEverTrueOnLine;
if (canPlaceOnLine && checkForBreak) {
w += tmpW;
tmpW = 0;
@@ -2570,6 +2572,7 @@
currentCharacterIsSpace = false;
pos = 0;
+ atStart = false;
}