| Index: Source/WebCore/rendering/RenderBlockLineLayout.cpp
|
| ===================================================================
|
| --- Source/WebCore/rendering/RenderBlockLineLayout.cpp (revision 139359)
|
| +++ Source/WebCore/rendering/RenderBlockLineLayout.cpp (working copy)
|
| @@ -2686,7 +2686,9 @@
|
| wordMeasurement.width = charWidth;
|
| }
|
| }
|
| - goto end; // Didn't fit. Jump to the end.
|
| + // Didn't fit. Jump to the end unless there's still an opportunity to collapse whitespace.
|
| + if (ignoringSpaces || !currentStyle->collapseWhiteSpace() || !currentCharacterIsSpace || !previousCharacterIsSpace)
|
| + goto end;
|
| } else {
|
| if (!betweenWords || (midWordBreak && !autoWrap))
|
| width.addUncommittedWidth(-additionalTmpW);
|
| @@ -2813,17 +2815,17 @@
|
| bool checkForBreak = autoWrap;
|
| if (width.committedWidth() && !width.fitsOnLine() && lBreak.m_obj && currWS == NOWRAP)
|
| checkForBreak = true;
|
| - else if (next && current.m_obj->isText() && next->isText() && !next->isBR() && (autoWrap || (next->style()->autoWrap()))) {
|
| - if (currentCharacterIsSpace)
|
| + else if (next && current.m_obj->isText() && next->isText() && !next->isBR() && (autoWrap || next->style()->autoWrap())) {
|
| + if (autoWrap && currentCharacterIsSpace)
|
| checkForBreak = true;
|
| else {
|
| RenderText* nextText = toRenderText(next);
|
| if (nextText->textLength()) {
|
| UChar c = nextText->characterAt(0);
|
| - checkForBreak = (c == ' ' || c == '\t' || (c == '\n' && !next->preservesNewline()));
|
| // If the next item on the line is text, and if we did not end with
|
| // a space, then the next text run continues our word (and so it needs to
|
| - // keep adding to |tmpW|. Just update and continue.
|
| + // keep adding to the uncommitted width. Just update and continue.
|
| + checkForBreak = !currentCharacterIsSpace && (c == ' ' || c == '\t' || (c == '\n' && !next->preservesNewline()));
|
| } else if (nextText->isWordBreak())
|
| checkForBreak = true;
|
|
|
| @@ -2878,15 +2880,8 @@
|
| end:
|
| if (lBreak == resolver.position() && (!lBreak.m_obj || !lBreak.m_obj->isBR())) {
|
| // we just add as much as possible
|
| - if (blockStyle->whiteSpace() == PRE) {
|
| - // FIXME: Don't really understand this case.
|
| - if (current.m_pos) {
|
| - // FIXME: This should call moveTo which would clear m_nextBreakablePosition
|
| - // this code as-is is likely wrong.
|
| - lBreak.m_obj = current.m_obj;
|
| - lBreak.m_pos = current.m_pos - 1;
|
| - } else
|
| - lBreak.moveTo(last, last->isText() ? last->length() : 0);
|
| + if (blockStyle->whiteSpace() == PRE && !current.m_pos) {
|
| + lBreak.moveTo(last, last->isText() ? last->length() : 0);
|
| } else if (lBreak.m_obj) {
|
| // Don't ever break in the middle of a word if we can help it.
|
| // There's no room at all. We just have to be on this line,
|
|
|