Skip to content
  • mitz@apple.com's avatar
    WebCore: Part of <rdar://problem/6649734> Text repainting does not account for... · 9cd3ea41
    mitz@apple.com authored
    WebCore: Part of <rdar://problem/6649734> Text repainting does not account for glyphs which draw outside the typographic bounds of the font
    https://bugs.webkit.org/show_bug.cgi?id=6274
    
    Reviewed by Adele Peterson.
    
    Account for glyph overflow of characters in the range U+1E00..U+2000, but without sending them
    through the complex text code path. Instead, introduce a variant of the fast path that tracks
    glyph overflow.
    
    * platform/graphics/Font.cpp:
    (WebCore::Font::drawText): Use codePath().
    (WebCore::Font::floatWidth): Use codePath(). Pass the GlyphOverflow pointer through to
    floatWidthForSimpleText() if the code path is SimpleWithGlyphOverflow.
    (WebCore::Font::selectionRectForText): Use codePath().
    (WebCore::Font::offsetForPosition): Ditto.
    * platform/graphics/Font.h: Replaced canUseGlyphCache() with codePath(). Added a GlyphOverflow
    parameter to floatWidthForSimpleText().
    * platform/graphics/FontFastPath.cpp:
    Removed ROMAN_AND_GREEK_DIACRITICS_CAN_USE_GLYPH_CACHE.
    (WebCore::Font::codePath): Renamed canUseGlyphCache() to this. Where it used to return false,
    it now returns Complex. Where it used to return true, it now returns Simple, except for
    the range U+1E00..U+2000, where it now returns SimpleWithGlyphOverflow.
    (WebCore::Font::floatWidthForSimpleText): Added a GlyphOverflow parameter. If not 0, have the
    width iterator account for glyph bounds, then update the GlyphOverflow accordingly.
    * platform/graphics/WidthIterator.cpp:
    (WebCore::WidthIterator::WidthIterator): Added boolean parameter telling the width iterator
    whether to account for glyph bounds. Initialize m_accountForGlyphBounds accordingly. Initialize
    m_maxGlyphBoundingBoxY, m_minGlyphBoundingBoxY, m_firstGlyphOverflow and m_lastGlyphOverflow.
    (WebCore::WidthIterator::advance): If accounting for glyph bounds, update the above member variables.
    * platform/graphics/WidthIterator.h:
    (WebCore::WidthIterator::maxGlyphBoundingBoxY): Added this accessor.
    (WebCore::WidthIterator::minGlyphBoundingBoxY): Ditto.
    (WebCore::WidthIterator::firstGlyphOverflow): Ditto.
    (WebCore::WidthIterator::lastGlyphOverflow): Ditto.
    
    LayoutTests: Updated results for <rdar://problem/6649734> Text repainting does not account for glyphs which draw outside the typographic bounds of the font
    https://bugs.webkit.org/show_bug.cgi?id=6274
    
    Reviewed by Adele Peterson.
    
    * platform/mac/fast/repaint/stacked-diacritics-expected.checksum:
    * platform/mac/fast/repaint/stacked-diacritics-expected.png:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    9cd3ea41