Changeset 52889 in webkit


Ignore:
Timestamp:
Jan 6, 2010 5:41:32 PM (14 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/7488126> With text-rendering: optimizelegibility, sometimes lines run too long
https://bugs.webkit.org/show_bug.cgi?id=32794

Reviewed by Sam Weinig.

WebCore:

Test: platform/mac/fast/text/line-breaking-with-kerning.html

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::findNextLineBreak): When kerning is enabled, include
the trailing space when measuring a word, then subtract its width. This
accounts for kerning between the last glyph of the word and the following space.

LayoutTests:

  • platform/mac/fast/text/line-breaking-with-kerning-expected.checksum: Added.
  • platform/mac/fast/text/line-breaking-with-kerning-expected.png: Added.
  • platform/mac/fast/text/line-breaking-with-kerning-expected.txt: Added.
  • platform/mac/fast/text/line-breaking-with-kerning.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r52888 r52889  
     12010-01-06  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        <rdar://problem/7488126> With text-rendering: optimizelegibility, sometimes lines run too long
     6        https://bugs.webkit.org/show_bug.cgi?id=32794
     7
     8        * platform/mac/fast/text/line-breaking-with-kerning-expected.checksum: Added.
     9        * platform/mac/fast/text/line-breaking-with-kerning-expected.png: Added.
     10        * platform/mac/fast/text/line-breaking-with-kerning-expected.txt: Added.
     11        * platform/mac/fast/text/line-breaking-with-kerning.html: Added.
     12
    1132010-01-06  Eric Seidel  <eric@webkit.org>
    214
  • trunk/WebCore/ChangeLog

    r52885 r52889  
     12010-01-06  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        <rdar://problem/7488126> With text-rendering: optimizelegibility, sometimes lines run too long
     6        https://bugs.webkit.org/show_bug.cgi?id=32794
     7
     8        Test: platform/mac/fast/text/line-breaking-with-kerning.html
     9
     10        * rendering/RenderBlockLineLayout.cpp:
     11        (WebCore::RenderBlock::findNextLineBreak): When kerning is enabled, include
     12        the trailing space when measuring a word, then subtract its width. This
     13        accounts for kerning between the last glyph of the word and the following space.
     14
    1152010-01-06  Kevin Decker  <kdecker@apple.com>
    216
  • trunk/WebCore/rendering/RenderBlockLineLayout.cpp

    r52839 r52889  
    18051805            int lastSpaceWordSpacing = 0;
    18061806
     1807            TextRenderingMode textRenderingMode = f.fontDescription().textRenderingMode();
     1808            // Non-zero only when kerning is enabled, in which case we measure words with their trailing
     1809            // space, then subtract its width.
     1810            int wordTrailingSpaceWidth = textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? f.spaceWidth() + wordSpacing : 0;
     1811
    18071812            int wrapW = tmpW + inlineWidth(o, !appliedStartWidth, true);
    18081813            int charWidth = 0;
     
    18991904                    }
    19001905
    1901                     int additionalTmpW = textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing;
     1906                    int additionalTmpW;
     1907                    if (wordTrailingSpaceWidth && currentCharacterIsSpace)
     1908                        additionalTmpW = textWidth(t, lastSpace, pos + 1 - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) - wordTrailingSpaceWidth + lastSpaceWordSpacing;
     1909                    else
     1910                        additionalTmpW = textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing;
    19021911                    tmpW += additionalTmpW;
    19031912                    if (!appliedStartWidth) {
Note: See TracChangeset for help on using the changeset viewer.