Changeset 117788 in webkit
- Timestamp:
- May 21, 2012 9:06:50 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117786 r117788 1 2012-05-21 Stephen Chenney <schenney@chromium.org> 2 3 SVGTextRunRenderingContext can return null font, calling code asserts not null 4 https://bugs.webkit.org/show_bug.cgi?id=86738 5 6 Reviewed by Nikolas Zimmermann. 7 8 SVGTextRunRenderingContext::glyphDataForCharacter was returning a glyph with 9 null font data for numerous code paths. It seems that it was doing so 10 whenever it detected null fontData, rather than try to continue. 11 Calling code would then immediately assert on this null fontData. 12 13 This patch refactors SVGTextRunRenderingContext::glyphDataForCharacter 14 so that it never returns null font data, adding an assertion to that 15 effect. In particular, when the font data is null the code will reach 16 the fallback glyph calculations. 17 18 Refactoring covered by existing tests. A previously crashing test, svg/custom/acid3-test-77.html, no longer crashes. 19 20 * rendering/svg/SVGTextRunRenderingContext.cpp: 21 (WebCore::SVGTextRunRenderingContext::glyphDataForCharacter): 22 1 23 2012-05-21 Ilya Tikhonovsky <loislo@chromium.org> 2 24 -
trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp
r101517 r117788 180 180 pair<GlyphData, GlyphPage*> pair = font.glyphDataAndPageForCharacter(character, mirror); 181 181 GlyphData glyphData = pair.first; 182 if (!glyphData.fontData) 182 183 // Check if we have the missing glyph data, in which case we can just return. 184 GlyphData missingGlyphData = primaryFont->missingGlyphData(); 185 if (glyphData.glyph == missingGlyphData.glyph && glyphData.fontData == missingGlyphData.fontData) { 186 ASSERT(glyphData.fontData); 183 187 return glyphData; 184 185 GlyphData missingGlyphData = primaryFont->missingGlyphData(); 186 if (glyphData.glyph == missingGlyphData.glyph && glyphData.fontData == missingGlyphData.fontData) 187 return glyphData; 188 } 188 189 189 190 // Characters enclosed by an <altGlyph> element, may not be registered in the GlyphPage. 190 if ( !glyphData.fontData->isSVGFont()) {191 if (glyphData.fontData && !glyphData.fontData->isSVGFont()) { 191 192 if (TextRun::RenderingContext* renderingContext = run.renderingContext()) { 192 193 RenderObject* renderObject = static_cast<SVGTextRunRenderingContext*>(renderingContext)->renderer(); … … 200 201 } 201 202 202 if (!glyphData.fontData || !glyphData.fontData->isSVGFont())203 return glyphData;204 205 203 const SimpleFontData* fontData = glyphData.fontData; 206 207 SVGFontElement* fontElement = 0; 208 SVGFontFaceElement* fontFaceElement = 0; 209 210 const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(fontData, fontFaceElement, fontElement); 211 if (!fontElement || !fontFaceElement) 212 return glyphData; 213 214 // If we got here, we're dealing with a glyph defined in a SVG Font. 215 // The returned glyph by glyphDataAndPageForCharacter() is a glyph stored in the SVG Font glyph table. 216 // This doesn't necessarily mean the glyph is suitable for rendering/measuring in this context, its 217 // arabic-form/orientation/... may not match, we have to apply SVG Glyph selection to discover that. 218 if (svgFontData->applySVGGlyphSelection(iterator, glyphData, mirror, currentCharacter, advanceLength)) 219 return glyphData; 204 if (fontData) { 205 if (!fontData->isSVGFont()) 206 return glyphData; 207 208 SVGFontElement* fontElement = 0; 209 SVGFontFaceElement* fontFaceElement = 0; 210 211 const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(fontData, fontFaceElement, fontElement); 212 if (!fontElement || !fontFaceElement) 213 return glyphData; 214 215 // If we got here, we're dealing with a glyph defined in a SVG Font. 216 // The returned glyph by glyphDataAndPageForCharacter() is a glyph stored in the SVG Font glyph table. 217 // This doesn't necessarily mean the glyph is suitable for rendering/measuring in this context, its 218 // arabic-form/orientation/... may not match, we have to apply SVG Glyph selection to discover that. 219 if (svgFontData->applySVGGlyphSelection(iterator, glyphData, mirror, currentCharacter, advanceLength)) 220 return glyphData; 221 } 220 222 221 223 GlyphPage* page = pair.second; … … 241 243 fontList->setGlyphPageZero(originalGlyphPageZero); 242 244 fontList->setGlyphPages(originalGlyphPages); 245 ASSERT(fallbackGlyphData.fontData); 243 246 return fallbackGlyphData; 244 247 }
Note: See TracChangeset
for help on using the changeset viewer.