Changeset 129284 in webkit


Ignore:
Timestamp:
Sep 21, 2012 6:00:01 PM (12 years ago)
Author:
mitz@apple.com
Message:

REGRESSION (r129176): Incorrect line breaking when kerning occurs between a space and the following character
https://bugs.webkit.org/show_bug.cgi?id=97377

Reviewed by Enrica Casucci.

Source/WebCore:

Test: fast/text/kerning-with-TextLayout.html

When kerning is enabled, the last character in a word may have its advance shortened because
of its trailing space. To account for that, words are measured along with the trailing space,
then the width of a space is subtracted from the result. This doesn’t work when the trailing
space itself has its advance shortened due to the character following it, which can happen
when using the TextLayout optimization. However, when the optimization is used, the advance
of the last character of the word is already adjusted for the trailing space, so there is no
need to measure with that space and subtract its advance.

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::LineBreaker::nextLineBreak): Changed to not use the trailingSpaceWidth
mechanism when TextLayout is being used.

LayoutTests:

  • fast/text/kerning-with-TextLayout-expected.html: Added.
  • fast/text/kerning-with-TextLayout.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r129281 r129284  
     12012-09-21  Dan Bernstein  <mitz@apple.com>
     2
     3        REGRESSION (r129176): Incorrect line breaking when kerning occurs between a space and the following character
     4        https://bugs.webkit.org/show_bug.cgi?id=97377
     5
     6        Reviewed by Enrica Casucci.
     7
     8        * fast/text/kerning-with-TextLayout-expected.html: Added.
     9        * fast/text/kerning-with-TextLayout.html: Added.
     10
    1112012-09-21  Gavin Barraclough  <barraclough@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r129280 r129284  
     12012-09-21  Dan Bernstein  <mitz@apple.com>
     2
     3        REGRESSION (r129176): Incorrect line breaking when kerning occurs between a space and the following character
     4        https://bugs.webkit.org/show_bug.cgi?id=97377
     5
     6        Reviewed by Enrica Casucci.
     7
     8        Test: fast/text/kerning-with-TextLayout.html
     9
     10        When kerning is enabled, the last character in a word may have its advance shortened because
     11        of its trailing space. To account for that, words are measured along with the trailing space,
     12        then the width of a space is subtracted from the result. This doesn’t work when the trailing
     13        space itself has its advance shortened due to the character following it, which can happen
     14        when using the TextLayout optimization. However, when the optimization is used, the advance
     15        of the last character of the word is already adjusted for the trailing space, so there is no
     16        need to measure with that space and subtract its advance.
     17
     18        * rendering/RenderBlockLineLayout.cpp:
     19        (WebCore::RenderBlock::LineBreaker::nextLineBreak): Changed to not use the trailingSpaceWidth
     20        mechanism when TextLayout is being used.
     21
    1222012-09-21  Adam Klein  <adamk@chromium.org>
    223
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r128713 r129284  
    24152415            float lastSpaceWordSpacing = 0;
    24162416
    2417             // Non-zero only when kerning is enabled, in which case we measure words with their trailing
    2418             // space, then subtract its width.
    2419             float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(constructTextRun(t, f, &space, 1, style)) + wordSpacing : 0;
    2420 
    24212417            float wrapW = width.uncommittedWidth() + inlineLogicalWidth(current.m_obj, !appliedStartWidth, true);
    24222418            float charWidth = 0;
     
    24472443
    24482444            TextLayout* textLayout = renderTextInfo.m_layout.get();
     2445
     2446            // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure
     2447            // words with their trailing space, then subtract its width.
     2448            float wordTrailingSpaceWidth = (f.typesettingFeatures() & Kerning) && !textLayout ? f.width(constructTextRun(t, f, &space, 1, style)) + wordSpacing : 0;
    24492449
    24502450            for (; current.m_pos < t->textLength(); current.fastIncrementInTextNode()) {
Note: See TracChangeset for help on using the changeset viewer.