Changeset 146087 in webkit


Ignore:
Timestamp:
Mar 18, 2013 11:01:05 AM (11 years ago)
Author:
dino@apple.com
Message:

Only add wordspacing when kerning to actual word ends
https://bugs.webkit.org/show_bug.cgi?id=112507
<rdar://problem/12945869>

Reviewed by Enrica Casucci.

Source/WebCore:

When measuring text, we currently include any word spacing in
the result (it's removed later). When kerning is active, we
were adding the word spacing to every wordMeasurement instance
whether or not it is a separate word. For example, a nested
<span> element would get a wordMeasurement, even though it
should not always get word spacing.

Test: fast/text/word-space-with-kerning-3.html

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::setLogicalWidthForTextRun): Test if the current character
referenced by the wordMeasurement is a space character, and add word
spacing only then.

LayoutTests:

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

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r146086 r146087  
     12013-03-18  Dean Jackson  <dino@apple.com>
     2
     3        Only add wordspacing when kerning to actual word ends
     4        https://bugs.webkit.org/show_bug.cgi?id=112507
     5        <rdar://problem/12945869>
     6
     7        Reviewed by Enrica Casucci.
     8
     9        * fast/text/word-space-with-kerning-3-expected.html: Added.
     10        * fast/text/word-space-with-kerning-3.html: Added.
     11
    1122013-03-18  Tony Chang  <tony@chromium.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r146086 r146087  
     12013-03-18  Dean Jackson  <dino@apple.com>
     2
     3        Only add wordspacing when kerning to actual word ends
     4        https://bugs.webkit.org/show_bug.cgi?id=112507
     5        <rdar://problem/12945869>
     6
     7        Reviewed by Enrica Casucci.
     8
     9        When measuring text, we currently include any word spacing in
     10        the result (it's removed later). When kerning is active, we
     11        were adding the word spacing to every wordMeasurement instance
     12        whether or not it is a separate word. For example, a nested
     13        <span> element would get a wordMeasurement, even though it
     14        should not always get word spacing.
     15
     16        Test: fast/text/word-space-with-kerning-3.html
     17
     18        * rendering/RenderBlockLineLayout.cpp:
     19        (WebCore::setLogicalWidthForTextRun): Test if the current character
     20        referenced by the wordMeasurement is a space character, and add word
     21        spacing only then.
     22
    1232013-03-18  Tony Chang  <tony@chromium.org>
    224
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r146073 r146087  
    830830            lastEndOffset = wordMeasurement.endOffset;
    831831            if (kerningIsEnabled && lastEndOffset == run->m_stop) {
    832                 measuredWidth += renderer->width(wordMeasurement.startOffset, lastEndOffset - wordMeasurement.startOffset, xPos, lineInfo.isFirstLine());
    833                 if (i > 0)
     832                int wordLength = lastEndOffset - wordMeasurement.startOffset;
     833                measuredWidth += renderer->width(wordMeasurement.startOffset, wordLength, xPos, lineInfo.isFirstLine());
     834                if (i > 0 && wordLength == 1 && renderer->characterAt(wordMeasurement.startOffset) == ' ')
    834835                    measuredWidth += renderer->style()->wordSpacing();
    835836            } else
Note: See TracChangeset for help on using the changeset viewer.