Changeset 93909 in webkit


Ignore:
Timestamp:
Aug 26, 2011 1:43:48 PM (13 years ago)
Author:
mitz@apple.com
Message:

RenderText::computePreferredLogicalWidths() should measure words with trailing spaces
https://bugs.webkit.org/show_bug.cgi?id=66733

Source/WebCore:

Patch by Ned Holbrook <nholbrook@apple.com> on 2011-08-26
Reviewed by Dan Bernstein.

Test: fast/text/complex-preferred-logical-widths.html

  • rendering/RenderText.cpp:

(WebCore::RenderText::computePreferredLogicalWidths): Apply logic from RenderBlock::LineBreaker::nextLineBreak().

LayoutTests:

  • fast/text/complex-preferred-logical-widths.html: Added.
  • platform/mac/fast/text/complex-preferred-logical-widths-expected.txt: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r93908 r93909  
     12011-08-26  Dan Bernstein  <mitz@apple.com>
     2
     3        RenderText::computePreferredLogicalWidths() should measure words with trailing spaces
     4        https://bugs.webkit.org/show_bug.cgi?id=66733
     5
     6        * fast/text/complex-preferred-logical-widths.html: Added.
     7        * platform/mac/fast/text/complex-preferred-logical-widths-expected.txt: Added.
     8
    192011-08-26  Tony Chang  <tony@chromium.org>
    210
  • trunk/Source/WebCore/ChangeLog

    r93908 r93909  
     12011-08-26  Ned Holbrook  <nholbrook@apple.com>
     2
     3        RenderText::computePreferredLogicalWidths() should measure words with trailing spaces
     4        https://bugs.webkit.org/show_bug.cgi?id=66733
     5
     6        Reviewed by Dan Bernstein.
     7
     8        Test: fast/text/complex-preferred-logical-widths.html
     9
     10        * rendering/RenderText.cpp:
     11        (WebCore::RenderText::computePreferredLogicalWidths): Apply logic from RenderBlock::LineBreaker::nextLineBreak().
     12
    1132011-08-26  Tony Chang  <tony@chromium.org>
    214
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r93656 r93909  
    915915    int lastWordBoundary = 0;
    916916
     917    // Non-zero only when kerning is enabled, in which case we measure words with their trailing
     918    // space, then subtract its width.
     919    float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, style())) : 0;
     920
    917921    int firstGlyphLeftOverflow = -1;
    918922
     
    984988        int wordLen = j - i;
    985989        if (wordLen) {
    986             float w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow);
     990            bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style());
     991            float w;
     992            if (wordTrailingSpaceWidth && isSpace)
     993                w = widthFromCache(f, i, wordLen + 1, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow) - wordTrailingSpaceWidth;
     994            else
     995                w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow);
     996
    987997            if (firstGlyphLeftOverflow < 0)
    988998                firstGlyphLeftOverflow = glyphOverflow.left;
     
    9961006            }
    9971007
    998             bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style());
    9991008            bool isCollapsibleWhiteSpace = (j < len) && style()->isCollapsibleWhiteSpace(c);
    10001009            if (j < len && style()->autoWrap())
Note: See TracChangeset for help on using the changeset viewer.