Changeset 191386 in webkit
- Timestamp:
- Oct 21, 2015 5:52:17 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r191385 r191386 1 2015-10-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 ASSERTION FAILED: markFontData in FontCascade::emphasisMarkHeight 4 https://bugs.webkit.org/show_bug.cgi?id=150171 5 6 Reviewed by Myles C. Maxfield. 7 8 It happens with several tests like fast/ruby/text-emphasis.html in 9 the GTK Debug bot. The tests seem to pass in Release and the rendering 10 looks correct as well removing the assert. The thing is that 11 for some reason we can get an empty GlyphData from 12 FontCascade::getEmphasisMarkGlyphData() when it ends up falling 13 back to system (FontCascadeFonts::glyphDataForSystemFallback). 14 15 * platform/graphics/FontCascade.cpp: 16 (WebCore::FontCascade::getEmphasisMarkGlyphData): Return 17 Optional<GlyphData> instead of returning a boolean and an out 18 parameter. If we get an invalid GlyphData, Nullopt is 19 returned. Also use a SurrogatePairAwareTextIterator to handle 20 surrogate pairs. 21 (WebCore::FontCascade::emphasisMarkAscent): 22 (WebCore::FontCascade::emphasisMarkDescent): 23 (WebCore::FontCascade::emphasisMarkHeight): 24 (WebCore::FontCascade::drawEmphasisMarks): 25 * platform/graphics/FontCascade.h: 26 * platform/graphics/GlyphPage.h: 27 (WebCore::GlyphData::isValid): Return whether the GlyphData is valid. 28 1 29 2015-10-20 Sergio Villar Senin <svillar@igalia.com> 2 30 -
trunk/Source/WebCore/platform/graphics/FontCascade.cpp
r191331 r191386 30 30 #include "GlyphBuffer.h" 31 31 #include "LayoutRect.h" 32 #include "SurrogatePairAwareTextIterator.h" 32 33 #include "TextRun.h" 33 34 #include "WidthIterator.h" … … 1198 1199 // FIXME: This function may not work if the emphasis mark uses a complex script, but none of the 1199 1200 // standard emphasis marks do so. 1200 bool FontCascade::getEmphasisMarkGlyphData(const AtomicString& mark, GlyphData& glyphData) const1201 Optional<GlyphData> FontCascade::getEmphasisMarkGlyphData(const AtomicString& mark) const 1201 1202 { 1202 1203 if (mark.isEmpty()) 1203 return false; 1204 1205 UChar32 character = mark[0]; 1206 1207 if (U16_IS_SURROGATE(character)) { 1208 if (!U16_IS_SURROGATE_LEAD(character)) 1209 return false; 1210 1211 if (mark.length() < 2) 1212 return false; 1213 1214 UChar low = mark[1]; 1215 if (!U16_IS_TRAIL(low)) 1216 return false; 1217 1218 character = U16_GET_SUPPLEMENTARY(character, low); 1219 } 1220 1221 glyphData = glyphDataForCharacter(character, false, EmphasisMarkVariant); 1222 return true; 1204 return Nullopt; 1205 1206 UChar32 character; 1207 if (!mark.is8Bit()) { 1208 SurrogatePairAwareTextIterator iterator(mark.characters16(), 0, mark.length(), mark.length()); 1209 unsigned clusterLength; 1210 if (!iterator.consume(character, clusterLength)) 1211 return Nullopt; 1212 } else 1213 character = mark[0]; 1214 1215 Optional<GlyphData> glyphData(glyphDataForCharacter(character, false, EmphasisMarkVariant)); 1216 return glyphData.value().isValid() ? glyphData : Nullopt; 1223 1217 } 1224 1218 1225 1219 int FontCascade::emphasisMarkAscent(const AtomicString& mark) const 1226 1220 { 1227 GlyphData markGlyphData;1228 if (! getEmphasisMarkGlyphData(mark, markGlyphData))1221 Optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); 1222 if (!markGlyphData) 1229 1223 return 0; 1230 1224 1231 const Font* markFontData = markGlyphData. font;1225 const Font* markFontData = markGlyphData.value().font; 1232 1226 ASSERT(markFontData); 1233 1227 if (!markFontData) … … 1239 1233 int FontCascade::emphasisMarkDescent(const AtomicString& mark) const 1240 1234 { 1241 GlyphData markGlyphData;1242 if (! getEmphasisMarkGlyphData(mark, markGlyphData))1235 Optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); 1236 if (!markGlyphData) 1243 1237 return 0; 1244 1238 1245 const Font* markFontData = markGlyphData. font;1239 const Font* markFontData = markGlyphData.value().font; 1246 1240 ASSERT(markFontData); 1247 1241 if (!markFontData) … … 1253 1247 int FontCascade::emphasisMarkHeight(const AtomicString& mark) const 1254 1248 { 1255 GlyphData markGlyphData;1256 if (! getEmphasisMarkGlyphData(mark, markGlyphData))1249 Optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); 1250 if (!markGlyphData) 1257 1251 return 0; 1258 1252 1259 const Font* markFontData = markGlyphData. font;1253 const Font* markFontData = markGlyphData.value().font; 1260 1254 ASSERT(markFontData); 1261 1255 if (!markFontData) … … 1390 1384 void FontCascade::drawEmphasisMarks(GraphicsContext& context, const TextRun& run, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const 1391 1385 { 1392 GlyphData markGlyphData;1393 if (! getEmphasisMarkGlyphData(mark, markGlyphData))1386 Optional<GlyphData> markGlyphData = getEmphasisMarkGlyphData(mark); 1387 if (!markGlyphData) 1394 1388 return; 1395 1389 1396 const Font* markFontData = markGlyphData. font;1390 const Font* markFontData = markGlyphData.value().font; 1397 1391 ASSERT(markFontData); 1398 1392 if (!markFontData) 1399 1393 return; 1400 1394 1401 Glyph markGlyph = markGlyphData. glyph;1395 Glyph markGlyph = markGlyphData.value().glyph; 1402 1396 Glyph spaceGlyph = markFontData->spaceGlyph(); 1403 1397 -
trunk/Source/WebCore/platform/graphics/FontCascade.h
r191331 r191386 34 34 #include <wtf/HashMap.h> 35 35 #include <wtf/HashSet.h> 36 #include <wtf/Optional.h> 36 37 #include <wtf/WeakPtr.h> 37 38 #include <wtf/unicode/CharacterNames.h> … … 232 233 void adjustSelectionRectForSimpleText(const TextRun&, LayoutRect& selectionRect, int from, int to) const; 233 234 234 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const;235 Optional<GlyphData> getEmphasisMarkGlyphData(const AtomicString&) const; 235 236 236 237 static bool canReturnFallbackFontsForComplexText(); -
trunk/Source/WebCore/platform/graphics/GlyphPage.h
r189539 r191386 50 50 { 51 51 } 52 53 bool isValid() const { return glyph || font; } 54 52 55 Glyph glyph; 53 56 const Font* font;
Note: See TracChangeset
for help on using the changeset viewer.