Changeset 129233 in webkit


Ignore:
Timestamp:
Sep 21, 2012 9:21:08 AM (12 years ago)
Author:
mitz@apple.com
Message:

REGRESSION (r126763): Incorrect line breaking when both kerning and word spacing are enabled
https://bugs.webkit.org/show_bug.cgi?id=97280

Reviewed by Adele Peterson.

Source/WebCore:

Font::width() never applies word spacing to the first character in the TextRun. The
TextLayout optimization tried to achieve this behavior by not applying word spacing to
any character, which led to this bug.

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

  • platform/graphics/mac/ComplexTextController.cpp:

(WebCore::TextLayout::TextLayout): Changed to use the given font rather than a version
without word spacing.
(WebCore::TextLayout::width): Added a check if the run starts with a space at a non-zero
offset. If that is the case, then the ComplexTextController has added word spacing to that
space, so subtract it here in order to maintain the behavior described above.

LayoutTests:

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

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r129230 r129233  
     12012-09-21  Dan Bernstein  <mitz@apple.com>
     2
     3        REGRESSION (r126763): Incorrect line breaking when both kerning and word spacing are enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=97280
     5
     6        Reviewed by Adele Peterson.
     7
     8        * fast/text/word-space-with-kerning-2-expected.html: Added.
     9        * fast/text/word-space-with-kerning-2.html: Added.
     10
    1112012-09-21  Sudarsana Nagineni  <sudarsana.nagineni@intel.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r129227 r129233  
     12012-09-21  Dan Bernstein  <mitz@apple.com>
     2
     3        REGRESSION (r126763): Incorrect line breaking when both kerning and word spacing are enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=97280
     5
     6        Reviewed by Adele Peterson.
     7
     8        Font::width() never applies word spacing to the first character in the TextRun. The
     9        TextLayout optimization tried to achieve this behavior by not applying word spacing to
     10        any character, which led to this bug.
     11
     12        Test: fast/text/word-space-with-kerning-2.html
     13
     14        * platform/graphics/mac/ComplexTextController.cpp:
     15        (WebCore::TextLayout::TextLayout): Changed to use the given font rather than a version
     16        without word spacing.
     17        (WebCore::TextLayout::width): Added a check if the run starts with a space at a non-zero
     18        offset. If that is the case, then the ComplexTextController has added word spacing to that
     19        space, so subtract it here in order to maintain the behavior described above.
     20
    1212012-09-21  Sheriff Bot  <webkit.review.bot@gmail.com>
    222
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r129176 r129233  
    4949
    5050    TextLayout(RenderText* text, const Font& font, float xPos)
    51         : m_font(fontWithNoWordSpacing(font))
     51        : m_font(font)
    5252        , m_run(constructTextRun(text, font, xPos))
    5353        , m_controller(adoptPtr(new ComplexTextController(&m_font, m_run, true)))
     
    5959        m_controller->advance(from, 0, ByWholeGlyphs);
    6060        float beforeWidth = m_controller->runWidthSoFar();
     61        if (m_font.wordSpacing() && from && Font::treatAsSpace(m_run[from]))
     62            beforeWidth += m_font.wordSpacing();
    6163        m_controller->advance(from + len, 0, ByWholeGlyphs);
    6264        float afterWidth = m_controller->runWidthSoFar();
     
    6567
    6668private:
    67     static Font fontWithNoWordSpacing(const Font& originalFont)
    68     {
    69         Font font(originalFont);
    70         font.setWordSpacing(0);
    71         return font;
    72     }
    73 
    7469    static TextRun constructTextRun(RenderText* text, const Font& font, float xPos)
    7570    {
Note: See TracChangeset for help on using the changeset viewer.