Changeset 189557 in webkit
- Timestamp:
- Sep 9, 2015 3:42:50 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r189550 r189557 1 2015-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 1 11 2015-09-09 Manuel Rego Casasnovas <rego@igalia.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r189555 r189557 1 2015-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 1 19 2015-09-09 Chris Dumez <cdumez@apple.com> 2 20 -
trunk/Source/WebCore/platform/graphics/WidthIterator.cpp
r185175 r189557 96 96 }; 97 97 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)); 98 static inline bool isSoftBankEmoji(UChar32 codepoint) 99 { 100 return codepoint >= 0xE001 && codepoint <= 0xE537; 101 } 102 103 inline 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 112 inline 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); 103 115 104 116 if (!glyphBuffer) … … 119 131 glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount); 120 132 121 #if !ENABLE(SVG_FONTS) 122 UNUSED_PARAM(iterator); 123 #else 133 #if ENABLE(SVG_FONTS) 124 134 // We need to handle transforms on SVG fonts internally, since they are rendered internally. 125 135 if (font->isSVGFont()) { 126 136 // SVG font ligatures are handled during glyph selection, only kerning remaining. 127 if ( iterator.run().renderingContext() && (typesettingFeatures & Kerning)) {137 if (run().renderingContext() && (typesettingFeatures & Kerning)) { 128 138 // FIXME: We could pass the necessary context down to this level so we can lazily create rendering contexts at this point. 129 139 // 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); 131 141 } 132 142 } else … … 193 203 expandRight = true; 194 204 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 -> TransformsType203 {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;209 205 } 210 206 … … 270 266 auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter); 271 267 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); 273 269 if (glyphBuffer) 274 270 glyphBuffer->shrink(lastGlyphCount); … … 428 424 auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter); 429 425 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); 431 427 if (glyphBuffer) 432 428 glyphBuffer->shrink(lastGlyphCount); -
trunk/Source/WebCore/platform/graphics/WidthIterator.h
r185176 r189557 36 36 class TextRun; 37 37 struct GlyphData; 38 struct OriginalAdvancesForCharacterTreatedAsSpace; 39 40 typedef Vector<std::pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace; 38 41 39 42 struct WidthIterator { … … 91 94 enum class TransformsType { None, Forced, NotForced }; 92 95 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&); 93 97 94 98 TypesettingFeatures m_typesettingFeatures;
Note: See TracChangeset
for help on using the changeset viewer.