Changeset 26846 in webkit
- Timestamp:
- Oct 21, 2007, 12:10:55 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r26840 r26846 1 2007-10-21 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt. 4 5 - test for http://bugs.webkit.org/show_bug.cgi?id=15259 6 <rdar://problem/5499902> REGRESSION: Text overflows when using word spacing and centering (affects myspace.com music videos page) 7 8 * fast/text/word-space.html: Added. 9 * platform/mac/fast/css/word-space-extra-expected.txt: Updated result. 10 * platform/mac/fast/text/word-space-expected.checksum: Added. 11 * platform/mac/fast/text/word-space-expected.png: Added. 12 * platform/mac/fast/text/word-space-expected.txt: Added. 13 1 14 2007-10-20 Dan Bernstein <mitz@apple.com> 2 15 -
trunk/LayoutTests/platform/mac/fast/css/word-space-extra-expected.txt
r25970 r26846 7 7 RenderText {#text} at (0,0) size 138x28 8 8 text run at (0,0) width 138: "word-spacing" 9 RenderBlock (floating) {PRE} at (0,60) size 1 164x16710 RenderBlock {H3} at (0,15) size 1 164x179 RenderBlock (floating) {PRE} at (0,60) size 1224x167 10 RenderBlock {H3} at (0,15) size 1224x17 11 11 RenderText {#text} at (0,0) size 204x17 12 12 text run at (0,0) width 204: "In a floated pre" 13 RenderBlock (anonymous) at (0,47) size 1 164x12013 RenderBlock (anonymous) at (0,47) size 1224x120 14 14 RenderText {#text} at (0,0) size 220x30 15 15 text run at (0,0) width 0: " " … … 146 146 text run at (1068,105) width 0: " " 147 147 RenderBlock (anonymous) at (0,47) size 769x193 148 RenderBR {BR} at (1 164,0) size 0x18148 RenderBR {BR} at (1224,0) size 0x18 149 149 RenderBlock {PRE} at (0,255) size 769x152 150 150 RenderBlock {H3} at (0,0) size 769x17 … … 894 894 RenderText {#text} at (0,0) size 131x28 895 895 text run at (0,0) width 131: "both-spacing" 896 RenderBlock (floating) {PRE} at (0,1599) size 19 18x167897 RenderBlock {H3} at (0,15) size 19 18x17896 RenderBlock (floating) {PRE} at (0,1599) size 1978x167 897 RenderBlock {H3} at (0,15) size 1978x17 898 898 RenderText {#text} at (0,0) size 284x17 899 899 text run at (0,0) width 284: "In a floated pre" 900 RenderBlock (anonymous) at (0,47) size 19 18x120900 RenderBlock (anonymous) at (0,47) size 1978x120 901 901 RenderText {#text} at (0,0) size 503x30 902 902 text run at (0,0) width 0: " " … … 1033 1033 text run at (1731,105) width 0: " " 1034 1034 RenderBlock (anonymous) at (0,1586) size 769x193 1035 RenderBR {BR} at (19 18,0) size 0x181035 RenderBR {BR} at (1978,0) size 0x18 1036 1036 RenderBlock {PRE} at (0,1794) size 769x152 1037 1037 RenderBlock {H3} at (0,0) size 769x17 -
trunk/WebCore/ChangeLog
r26843 r26846 1 2007-10-21 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt. 4 5 - fix http://bugs.webkit.org/show_bug.cgi?id=15259 6 <rdar://problem/5499902> REGRESSION: Text overflows when using word spacing and centering (affects myspace.com music videos page) 7 8 Test: fast/text/word-space.html 9 10 * rendering/RenderBlock.cpp: 11 (WebCore::stripTrailingSpace): Added word-spacing to the width of the 12 space being stripped out. 13 * rendering/RenderText.cpp: 14 (WebCore::RenderText::trimmedPrefWidths): Changed handling of 15 leading space. Since Font::width includes leading space width but not 16 leading word spacing, this method needs to either remove the width of a 17 space character or add word spacing, 18 depending on stripFrontSpaces. 19 (WebCore::RenderText::calcPrefWidths): Corrected the check for adding 20 trailing word spacing so that it would work in the case where the last 21 space is ignored. 22 * rendering/bidi.cpp: 23 (WebCore::RenderBlock::computeHorizontalPositionsForLine): Changed to 24 actually add word spacing to the total width. 25 1 26 2007-10-20 David Hyatt <hyatt@apple.com> 2 27 -
trunk/WebCore/rendering/RenderBlock.cpp
r25754 r26846 3527 3527 RenderText* t = static_cast<RenderText*>(trailingSpaceChild); 3528 3528 const UChar space = ' '; 3529 int spaceWidth = t->style()->font().width(TextRun(&space, 1)); // FIXME: This ignores first-line. 3530 inlineMax -= spaceWidth; 3529 const Font& font = t->style()->font(); // FIXME: This ignores first-line. 3530 int spaceWidth = font.width(TextRun(&space, 1)); 3531 inlineMax -= spaceWidth + font.wordSpacing(); 3531 3532 if (inlineMin > inlineMax) 3532 3533 inlineMin = inlineMax; -
trunk/WebCore/rendering/RenderText.cpp
r26746 r26846 448 448 hasBreak = m_hasBreak; 449 449 450 if ( stripFrontSpaces && ((*m_text)[0] == ' ' || ((*m_text)[0] == '\n' && !style()->preserveNewline()) || (*m_text)[0] == '\t')) {450 if ((*m_text)[0] == ' ' || ((*m_text)[0] == '\n' && !style()->preserveNewline()) || (*m_text)[0] == '\t') { 451 451 const Font& f = style()->font(); // FIXME: This ignores first-line. 452 const UChar space = ' '; 453 int spaceWidth = f.width(TextRun(&space, 1)); 454 maxW -= spaceWidth + f.wordSpacing(); 452 if (stripFrontSpaces) { 453 const UChar space = ' '; 454 int spaceWidth = f.width(TextRun(&space, 1)); 455 maxW -= spaceWidth; 456 } else 457 maxW += f.wordSpacing(); 455 458 } 456 459 … … 677 680 } 678 681 679 if (needsWordSpacing && len > 1 )682 if (needsWordSpacing && len > 1 || ignoringSpaces && !firstWord) 680 683 currMaxWidth += wordSpacing; 681 684 -
trunk/WebCore/rendering/bidi.cpp
r26434 r26846 646 646 RenderText* rt = static_cast<RenderText*>(r->obj); 647 647 int textWidth = rt->width(r->m_start, r->m_stop - r->m_start, totWidth, m_firstLine); 648 int effectiveWidth = textWidth;649 648 int rtLength = rt->textLength(); 650 649 if (rtLength != 0) { 651 if (!r-> m_start && needsWordSpacing && DeprecatedChar(rt->characters()[r->m_start]).isSpace())652 effectiveWidth += rt->style(m_firstLine)->font().wordSpacing();650 if (!r->compact && !r->m_start && needsWordSpacing && DeprecatedChar(rt->characters()[r->m_start]).isSpace()) 651 totWidth += rt->style(m_firstLine)->font().wordSpacing(); 653 652 needsWordSpacing = !DeprecatedChar(rt->characters()[r->m_stop - 1]).isSpace() && r->m_stop == rtLength; 654 653 }
Note:
See TracChangeset
for help on using the changeset viewer.