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

Unified Diff: Source/core/rendering/RenderText.cpp

Issue 17072005: Floated elements inside a white-space:nowrap container should still wrap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: now sans binary files. Created 7 years, 6 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 | « Source/core/rendering/RenderText.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderText.cpp
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
index 13d84d9aa8aa899b96369c50f4357126d6e4361e..acf10421cc0fe79bc56a90d5ffb61bb82e35976a 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -819,7 +819,7 @@ void RenderText::trimmedPrefWidths(float leadWidth,
}
}
- stripFrontSpaces = collapseWhiteSpace && m_hasBreakableEnd;
+ stripFrontSpaces = collapseWhiteSpace && m_hasEndWhiteSpace;
if (!style()->autoWrap() || minWidth > maxWidth)
minWidth = maxWidth;
@@ -948,6 +948,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
m_hasTab = false;
m_hasBreakableStart = false;
m_hasBreakableEnd = false;
+ m_hasEndWhiteSpace = false;
RenderStyle* styleToUse = style();
const Font& f = styleToUse->font(); // FIXME: This ignores first-line.
@@ -1010,10 +1011,13 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
} else
isSpace = c == ' ';
- if ((isSpace || isNewline) && !i)
- m_hasBreakableStart = true;
- if ((isSpace || isNewline) && i == len - 1)
- m_hasBreakableEnd = true;
+ bool isBreakableLocation = isNewline || (isSpace && styleToUse->autoWrap());
+ if (!i)
+ m_hasBreakableStart = isBreakableLocation;
+ if (i == len - 1) {
+ m_hasBreakableEnd = isBreakableLocation;
+ m_hasEndWhiteSpace = isNewline || isSpace;
+ }
if (!ignoringSpaces && styleToUse->collapseWhiteSpace() && previousCharacterIsSpace && isSpace)
ignoringSpaces = true;
« no previous file with comments | « Source/core/rendering/RenderText.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698