Changeset 121050 in webkit
- Timestamp:
- Jun 22, 2012 1:06:54 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r121046 r121050 1 2012-06-22 Dan Bernstein <mitz@apple.com> 2 3 RenderText’s minimum preferred width is incorrect when soft hyphens are used 4 https://bugs.webkit.org/show_bug.cgi?id=89775 5 6 Reviewed by Simon Fraser. 7 8 * fast/text/soft-hyphen-min-preferred-width-expected.html: Added. 9 * fast/text/soft-hyphen-min-preferred-width.html: Added. 10 1 11 2012-06-22 Jan Keromnes <janx@linux.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r121048 r121050 1 2012-06-22 Dan Bernstein <mitz@apple.com> 2 3 RenderText’s minimum preferred width is incorrect when soft hyphens are used 4 https://bugs.webkit.org/show_bug.cgi?id=89775 5 6 Reviewed by Simon Fraser. 7 8 Test: fast/text/soft-hyphen-min-preferred-width.html 9 10 * rendering/RenderText.cpp: 11 (WebCore::hyphenWidth): Added this helper function. 12 (WebCore::RenderText::computePreferredLogicalWidths): In places where this function tests 13 for the soft hyphen character, added a check that the 'hyphens' style property is not set 14 to 'none', because in that case soft hyphens are not break opportunities. Also added an 15 explicit check to suppress break opportunities from isBreakable() if the occur after a 16 soft hyphen and 'hyphens' is set to 'none'. Finally, when measuring text up to a potential 17 line break, added the width of the hyphen string when needed. 18 1 19 2012-06-22 Dean Jackson <dino@apple.com> 2 20 -
trunk/Source/WebCore/rendering/RenderText.cpp
r120495 r121050 883 883 } 884 884 885 static inline float hyphenWidth(RenderText* renderer, const Font& font) 886 { 887 RenderStyle* style = renderer->style(); 888 return font.width(RenderBlock::constructTextRun(renderer, font, style->hyphenString().string(), style)); 889 } 890 885 891 void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow) 886 892 { … … 964 970 lastWordBoundary++; 965 971 continue; 966 } else if (c == softHyphen ) {972 } else if (c == softHyphen && styleToUse->hyphens() != HyphensNone) { 967 973 currMaxWidth += widthFromCache(f, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow); 968 974 if (firstGlyphLeftOverflow < 0) … … 975 981 bool betweenWords = true; 976 982 int j = i; 977 while (c != '\n' && !isSpaceAccordingToStyle(c, styleToUse) && c != '\t' && c != softHyphen) {983 while (c != '\n' && !isSpaceAccordingToStyle(c, styleToUse) && c != '\t' && (c != softHyphen || styleToUse->hyphens() == HyphensNone)) { 978 984 j++; 979 985 if (j == len) 980 986 break; 981 987 c = txt[j]; 982 if (isBreakable(breakIterator, j, nextBreakable, breakNBSP) )988 if (isBreakable(breakIterator, j, nextBreakable, breakNBSP) && txt[j - 1] != softHyphen) 983 989 break; 984 990 if (breakAll) { … … 994 1000 if (wordTrailingSpaceWidth && isSpace) 995 1001 w = widthFromCache(f, i, wordLen + 1, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow) - wordTrailingSpaceWidth; 996 else 1002 else { 997 1003 w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow); 1004 if (c == softHyphen && styleToUse->hyphens() != HyphensNone) 1005 currMinWidth += hyphenWidth(this, f); 1006 } 998 1007 999 1008 if (firstGlyphLeftOverflow < 0)
Note: See TracChangeset
for help on using the changeset viewer.