Changeset 189557 in webkit


Ignore:
Timestamp:
Sep 9, 2015 3:42:50 PM (9 years ago)
Author:
mmaxfield@apple.com
Message:

ASSERTION FAILED: typesettingFeatures & (Kerning | Ligatures) in WebCore::applyFontTransforms
https://bugs.webkit.org/show_bug.cgi?id=146194

Reviewed by Dean Jackson.

Source/WebCore:

We might trigger shaping even if the author hasn't specified kerning or ligatures.

Test: fast/text/softbank-emoji-no-ligatures-nor-kerning.html

  • platform/graphics/WidthIterator.cpp:

(WebCore::isSoftBankEmoji):
(WebCore::WidthIterator::applyFontTransforms):
(WebCore::WidthIterator::advanceInternal):
(WebCore::applyFontTransforms): Deleted.

  • platform/graphics/WidthIterator.h:

LayoutTests:

  • fast/text/softbank-emoji-no-ligatures-nor-kerning-expected.html: Added
  • fast/text/softbank-emoji-no-ligatures-nor-kerning.html: Added
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r189550 r189557  
     12015-09-09  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        ASSERTION FAILED: typesettingFeatures & (Kerning | Ligatures) in WebCore::applyFontTransforms
     4        https://bugs.webkit.org/show_bug.cgi?id=146194
     5
     6        Reviewed by Dean Jackson.
     7
     8        * fast/text/softbank-emoji-no-ligatures-nor-kerning-expected.html: Added
     9        * fast/text/softbank-emoji-no-ligatures-nor-kerning.html: Added
     10
    1112015-09-09  Manuel Rego Casasnovas  <rego@igalia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r189555 r189557  
     12015-09-09  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        ASSERTION FAILED: typesettingFeatures & (Kerning | Ligatures) in WebCore::applyFontTransforms
     4        https://bugs.webkit.org/show_bug.cgi?id=146194
     5
     6        Reviewed by Dean Jackson.
     7
     8        We might trigger shaping even if the author hasn't specified kerning or ligatures.
     9
     10        Test: fast/text/softbank-emoji-no-ligatures-nor-kerning.html
     11
     12        * platform/graphics/WidthIterator.cpp:
     13        (WebCore::isSoftBankEmoji):
     14        (WebCore::WidthIterator::applyFontTransforms):
     15        (WebCore::WidthIterator::advanceInternal):
     16        (WebCore::applyFontTransforms): Deleted.
     17        * platform/graphics/WidthIterator.h:
     18
    1192015-09-09  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebCore/platform/graphics/WidthIterator.cpp

    r185175 r189557  
    9696};
    9797
    98 typedef Vector<std::pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace;
    99 
    100 static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, bool force, CharactersTreatedAsSpace& charactersTreatedAsSpace)
    101 {
    102     ASSERT(typesettingFeatures & (Kerning | Ligatures));
     98static inline bool isSoftBankEmoji(UChar32 codepoint)
     99{
     100    return codepoint >= 0xE001 && codepoint <= 0xE537;
     101}
     102
     103inline auto WidthIterator::shouldApplyFontTransforms(const GlyphBuffer* glyphBuffer, int lastGlyphCount, UChar32 previousCharacter) const -> TransformsType
     104{
     105    if (glyphBuffer && glyphBuffer->size() == (lastGlyphCount + 1) && isSoftBankEmoji(previousCharacter))
     106        return TransformsType::Forced;
     107    if (m_run.length() <= 1 || !(m_typesettingFeatures & (Kerning | Ligatures)))
     108        return TransformsType::None;
     109    return TransformsType::NotForced;
     110}
     111
     112inline float WidthIterator::applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, TypesettingFeatures typesettingFeatures, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace& charactersTreatedAsSpace)
     113{
     114    ASSERT_UNUSED(previousCharacter, shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter) != WidthIterator::TransformsType::None);
    103115
    104116    if (!glyphBuffer)
     
    119131        glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount);
    120132
    121 #if !ENABLE(SVG_FONTS)
    122     UNUSED_PARAM(iterator);
    123 #else
     133#if ENABLE(SVG_FONTS)
    124134    // We need to handle transforms on SVG fonts internally, since they are rendered internally.
    125135    if (font->isSVGFont()) {
    126136        // SVG font ligatures are handled during glyph selection, only kerning remaining.
    127         if (iterator.run().renderingContext() && (typesettingFeatures & Kerning)) {
     137        if (run().renderingContext() && (typesettingFeatures & Kerning)) {
    128138            // FIXME: We could pass the necessary context down to this level so we can lazily create rendering contexts at this point.
    129139            // However, a larger refactoring of SVG fonts might necessary to sidestep this problem completely.
    130             iterator.run().renderingContext()->applySVGKerning(font, iterator, glyphBuffer, lastGlyphCount);
     140            run().renderingContext()->applySVGKerning(font, *this, glyphBuffer, lastGlyphCount);
    131141        }
    132142    } else
     
    193203        expandRight = true;
    194204    return std::make_pair(expandLeft, expandRight);
    195 }
    196 
    197 static inline bool isSoftBankEmoji(UChar32 codepoint)
    198 {
    199     return codepoint >= 0xE001 && codepoint <= 0xE537;
    200 }
    201 
    202 inline auto WidthIterator::shouldApplyFontTransforms(const GlyphBuffer* glyphBuffer, int lastGlyphCount, UChar32 previousCharacter) const -> TransformsType
    203 {
    204     if (glyphBuffer && glyphBuffer->size() == lastGlyphCount + 1 && isSoftBankEmoji(previousCharacter))
    205         return TransformsType::Forced;
    206     if (m_run.length() <= 1 || !(m_typesettingFeatures & (Kerning | Ligatures)))
    207         return TransformsType::None;
    208     return TransformsType::NotForced;
    209205}
    210206
     
    270266            auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter);
    271267            if (transformsType != TransformsType::None) {
    272                 m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
     268                m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, previousCharacter, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
    273269                if (glyphBuffer)
    274270                    glyphBuffer->shrink(lastGlyphCount);
     
    428424    auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter);
    429425    if (transformsType != TransformsType::None) {
    430         m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
     426        m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, previousCharacter, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
    431427        if (glyphBuffer)
    432428            glyphBuffer->shrink(lastGlyphCount);
  • trunk/Source/WebCore/platform/graphics/WidthIterator.h

    r185176 r189557  
    3636class TextRun;
    3737struct GlyphData;
     38struct OriginalAdvancesForCharacterTreatedAsSpace;
     39
     40typedef Vector<std::pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace;
    3841
    3942struct WidthIterator {
     
    9194    enum class TransformsType { None, Forced, NotForced };
    9295    TransformsType shouldApplyFontTransforms(const GlyphBuffer*, int lastGlyphCount, UChar32 previousCharacter) const;
     96    float applyFontTransforms(GlyphBuffer*, bool ltr, int& lastGlyphCount, const Font*, TypesettingFeatures, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace&);
    9397
    9498    TypesettingFeatures m_typesettingFeatures;
Note: See TracChangeset for help on using the changeset viewer.