Diff
Modified: trunk/LayoutTests/ChangeLog (93908 => 93909)
--- trunk/LayoutTests/ChangeLog 2011-08-26 20:42:27 UTC (rev 93908)
+++ trunk/LayoutTests/ChangeLog 2011-08-26 20:43:48 UTC (rev 93909)
@@ -1,3 +1,11 @@
+2011-08-26 Dan Bernstein <m...@apple.com>
+
+ RenderText::computePreferredLogicalWidths() should measure words with trailing spaces
+ https://bugs.webkit.org/show_bug.cgi?id=66733
+
+ * fast/text/complex-preferred-logical-widths.html: Added.
+ * platform/mac/fast/text/complex-preferred-logical-widths-expected.txt: Added.
+
2011-08-26 Tony Chang <t...@chromium.org>
Add CSS parsing for -webkit-flex-align
Added: trunk/LayoutTests/fast/text/complex-preferred-logical-widths.html (0 => 93909)
--- trunk/LayoutTests/fast/text/complex-preferred-logical-widths.html (rev 0)
+++ trunk/LayoutTests/fast/text/complex-preferred-logical-widths.html 2011-08-26 20:43:48 UTC (rev 93909)
@@ -0,0 +1 @@
+<div style="font-family: baskerville; border: solid blue; text-rendering: optimizelegibility; float: left;">The number of lines in this box should be one.</div>
Added: trunk/LayoutTests/platform/mac/fast/text/complex-preferred-logical-widths-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/text/complex-preferred-logical-widths-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/fast/text/complex-preferred-logical-widths-expected.txt (0 => 93909)
--- trunk/LayoutTests/platform/mac/fast/text/complex-preferred-logical-widths-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/complex-preferred-logical-widths-expected.txt 2011-08-26 20:43:48 UTC (rev 93909)
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock (floating) {DIV} at (0,0) size 308x24 [border: (3px solid #0000FF)]
+ RenderText {#text} at (3,3) size 302x18
+ text run at (3,3) width 302: "The number of lines in this box should be one."
Modified: trunk/Source/WebCore/ChangeLog (93908 => 93909)
--- trunk/Source/WebCore/ChangeLog 2011-08-26 20:42:27 UTC (rev 93908)
+++ trunk/Source/WebCore/ChangeLog 2011-08-26 20:43:48 UTC (rev 93909)
@@ -1,3 +1,15 @@
+2011-08-26 Ned Holbrook <nholbr...@apple.com>
+
+ RenderText::computePreferredLogicalWidths() should measure words with trailing spaces
+ https://bugs.webkit.org/show_bug.cgi?id=66733
+
+ Reviewed by Dan Bernstein.
+
+ Test: fast/text/complex-preferred-logical-widths.html
+
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::computePreferredLogicalWidths): Apply logic from RenderBlock::LineBreaker::nextLineBreak().
+
2011-08-26 Tony Chang <t...@chromium.org>
Add CSS parsing for -webkit-flex-align
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (93908 => 93909)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2011-08-26 20:42:27 UTC (rev 93908)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2011-08-26 20:43:48 UTC (rev 93909)
@@ -914,6 +914,10 @@
int nextBreakable = -1;
int lastWordBoundary = 0;
+ // Non-zero only when kerning is enabled, in which case we measure words with their trailing
+ // space, then subtract its width.
+ float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, style())) : 0;
+
int firstGlyphLeftOverflow = -1;
bool breakNBSP = style()->autoWrap() && style()->nbspMode() == SPACE;
@@ -983,7 +987,13 @@
int wordLen = j - i;
if (wordLen) {
- float w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow);
+ bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style());
+ float w;
+ if (wordTrailingSpaceWidth && isSpace)
+ w = widthFromCache(f, i, wordLen + 1, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow) - wordTrailingSpaceWidth;
+ else
+ w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow);
+
if (firstGlyphLeftOverflow < 0)
firstGlyphLeftOverflow = glyphOverflow.left;
currMinWidth += w;
@@ -995,7 +1005,6 @@
lastWordBoundary = j;
}
- bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style());
bool isCollapsibleWhiteSpace = (j < len) && style()->isCollapsibleWhiteSpace(c);
if (j < len && style()->autoWrap())
m_hasBreakableChar = true;