Changeset 194132 in webkit
- Timestamp:
- Dec 15, 2015 10:28:13 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r194125 r194132 1 2015-12-15 Zalan Bujtas <zalan@apple.com> 2 3 FontCascade cleanup: Remove ::drawSimpleText and ::drawComplexText. 4 https://bugs.webkit.org/show_bug.cgi?id=152323 5 6 Reviewed by Myles C. Maxfield. 7 8 Platform code for ::drawComplexText() is redundant and has 9 no platform dependent logic. Move it all to ::drawText() 10 11 No change in functionality. 12 13 * platform/graphics/FontCascade.cpp: 14 (WebCore::FontCascade::glyphBufferForTextRun): 15 (WebCore::FontCascade::drawText): 16 (WebCore::FontCascade::drawSimpleText): Deleted. 17 * platform/graphics/FontCascade.h: 18 * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: 19 (WebCore::FontCascade::drawComplexText): Deleted. 20 * platform/graphics/cocoa/FontCascadeCocoa.mm: 21 (WebCore::FontCascade::drawComplexText): Deleted. 22 * platform/graphics/win/FontWin.cpp: 23 (WebCore::FontCascade::drawComplexText): Deleted. 24 1 25 2015-12-15 Tim Horton <timothy_horton@apple.com> 2 26 -
trunk/Source/WebCore/platform/graphics/FontCascade.cpp
r192992 r194132 307 307 } 308 308 309 float FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer) const 310 { 311 if (codePathToUse != Complex) 312 return getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer); 313 return getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer); 314 } 315 309 316 float FontCascade::drawText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to, CustomFontNotReadyAction customFontNotReadyAction) const 310 317 { … … 322 329 codePathToUse = Complex; 323 330 324 if (codePathToUse != Complex) 325 return drawSimpleText(context, run, point, from, to); 326 327 return drawComplexText(context, run, point, from, to); 331 GlyphBuffer glyphBuffer; 332 float startX = point.x() + glyphBufferForTextRun(codePathToUse, run, from, to, glyphBuffer); 333 // We couldn't generate any glyphs for the run. Give up. 334 if (glyphBuffer.isEmpty()) 335 return 0; 336 // Draw the glyph buffer now at the starting point returned in startX. 337 FloatPoint startPoint(startX, point.y()); 338 drawGlyphBuffer(context, run, glyphBuffer, startPoint); 339 return startPoint.x() - startX; 328 340 } 329 341 … … 1293 1305 } 1294 1306 1295 float FontCascade::drawSimpleText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const1296 {1297 // This glyph buffer holds our glyphs+advances+font data for each glyph.1298 GlyphBuffer glyphBuffer;1299 1300 float startX = point.x() + getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer);1301 1302 if (glyphBuffer.isEmpty())1303 return 0;1304 1305 FloatPoint startPoint(startX, point.y());1306 drawGlyphBuffer(context, run, glyphBuffer, startPoint);1307 1308 return startPoint.x() - startX;1309 }1310 1311 1307 void FontCascade::drawEmphasisMarksForSimpleText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const 1312 1308 { -
trunk/Source/WebCore/platform/graphics/FontCascade.h
r193894 r194132 223 223 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; 224 224 225 float glyphBufferForTextRun(CodePath, const TextRun&, int from, int to, GlyphBuffer&) const; 225 226 // Returns the initial in-stream advance. 226 227 float getGlyphsAndAdvancesForSimpleText(const TextRun&, int from, int to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; 227 float drawSimpleText(GraphicsContext&, const TextRun&, const FloatPoint&, int from, int to) const;228 228 void drawEmphasisMarksForSimpleText(GraphicsContext&, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const; 229 229 void drawGlyphBuffer(GraphicsContext&, const TextRun&, const GlyphBuffer&, FloatPoint&) const; … … 240 240 // Returns the initial in-stream advance. 241 241 float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; 242 float drawComplexText(GraphicsContext&, const TextRun&, const FloatPoint&, int from, int to) const;243 242 void drawEmphasisMarksForComplexText(GraphicsContext&, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const; 244 243 float floatWidthForComplexText(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const; -
trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
r189144 r194132 53 53 } 54 54 55 float FontCascade::drawComplexText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const56 {57 // This glyph buffer holds our glyphs + advances + font data for each glyph.58 GlyphBuffer glyphBuffer;59 60 float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);61 62 // We couldn't generate any glyphs for the run. Give up.63 if (glyphBuffer.isEmpty())64 return 0;65 66 // Draw the glyph buffer now at the starting point returned in startX.67 FloatPoint startPoint(startX, point.y());68 drawGlyphBuffer(context, run, glyphBuffer, startPoint);69 70 return startPoint.x() - startX;71 }72 73 55 void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const 74 56 { -
trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
r193894 r194132 643 643 } 644 644 645 float FontCascade::drawComplexText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const646 {647 // This glyph buffer holds our glyphs + advances + font data for each glyph.648 GlyphBuffer glyphBuffer;649 650 float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);651 652 // We couldn't generate any glyphs for the run. Give up.653 if (glyphBuffer.isEmpty())654 return 0;655 656 // Draw the glyph buffer now at the starting point returned in startX.657 FloatPoint startPoint(startX, point.y());658 drawGlyphBuffer(context, run, glyphBuffer, startPoint);659 660 return startPoint.x() - startX;661 }662 663 645 void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const 664 646 { -
trunk/Source/WebCore/platform/graphics/win/FontWin.cpp
r189144 r194132 92 92 } 93 93 94 float FontCascade::drawComplexText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const95 {96 // This glyph buffer holds our glyphs + advances + font data for each glyph.97 GlyphBuffer glyphBuffer;98 99 float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);100 101 // We couldn't generate any glyphs for the run. Give up.102 if (glyphBuffer.isEmpty())103 return 0;104 105 // Draw the glyph buffer now at the starting point returned in startX.106 FloatPoint startPoint(startX, point.y());107 drawGlyphBuffer(context, run, glyphBuffer, startPoint);108 return startPoint.x() - startX;109 }110 111 94 void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const 112 95 {
Note: See TracChangeset
for help on using the changeset viewer.