Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: Source/WebCore/rendering/RenderBlockLineLayout.cpp

Issue 11823064: Merge 138654 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/platform/mac/editing/execCommand/selectAll-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderBlockLineLayout.cpp
===================================================================
--- Source/WebCore/rendering/RenderBlockLineLayout.cpp (revision 139362)
+++ Source/WebCore/rendering/RenderBlockLineLayout.cpp (working copy)
@@ -2911,7 +2911,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);
@@ -3038,17 +3040,17 @@
bool checkForBreak = autoWrap || blockStyle->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;
@@ -3103,15 +3105,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,
« no previous file with comments | « LayoutTests/platform/mac/editing/execCommand/selectAll-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698