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

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: add missing expectations lines 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 5c2ff91236b44a3f6956448dff3cfa445c9d364e..2cd6e5a0f5051b9ba565ef30f3a2b1c60d60ec2d 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -818,7 +818,7 @@ void RenderText::trimmedPrefWidths(float leadWidth,
maxW += font.wordSpacing();
}
- stripFrontSpaces = collapseWhiteSpace && m_hasEndWS;
+ stripFrontSpaces = collapseWhiteSpace && m_hasEndWhiteSpace;
if (!style()->autoWrap() || minW > maxW)
minW = maxW;
@@ -946,6 +946,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
m_hasTab = false;
m_hasBeginWS = false;
m_hasEndWS = false;
+ m_hasEndWhiteSpace = false;
RenderStyle* styleToUse = style();
const Font& f = styleToUse->font(); // FIXME: This ignores first-line.
@@ -1008,10 +1009,13 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
} else
isSpace = c == ' ';
- if ((isSpace || isNewline) && !i)
- m_hasBeginWS = true;
- if ((isSpace || isNewline) && i == len - 1)
- m_hasEndWS = true;
+ bool isBreakableLocation = isNewline || (isSpace && styleToUse->autoWrap());
+ if (!i)
+ m_hasBeginWS = isBreakableLocation;
+ if (i == len - 1) {
+ m_hasEndWS = isBreakableLocation;
+ m_hasEndWhiteSpace = isNewline || isSpace;
cbiesinger 2013/06/14 22:45:50 OK, so the difference between m_hasEndWS and m_has
ojan 2013/06/14 22:53:37 There's a FIXME in RenderText.h to renamed m_hasEn
+ }
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