Diff
Modified: trunk/Source/WebCore/ChangeLog (194131 => 194132)
--- trunk/Source/WebCore/ChangeLog 2015-12-16 05:54:20 UTC (rev 194131)
+++ trunk/Source/WebCore/ChangeLog 2015-12-16 06:28:13 UTC (rev 194132)
@@ -1,3 +1,27 @@
+2015-12-15 Zalan Bujtas <[email protected]>
+
+ FontCascade cleanup: Remove ::drawSimpleText and ::drawComplexText.
+ https://bugs.webkit.org/show_bug.cgi?id=152323
+
+ Reviewed by Myles C. Maxfield.
+
+ Platform code for ::drawComplexText() is redundant and has
+ no platform dependent logic. Move it all to ::drawText()
+
+ No change in functionality.
+
+ * platform/graphics/FontCascade.cpp:
+ (WebCore::FontCascade::glyphBufferForTextRun):
+ (WebCore::FontCascade::drawText):
+ (WebCore::FontCascade::drawSimpleText): Deleted.
+ * platform/graphics/FontCascade.h:
+ * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
+ (WebCore::FontCascade::drawComplexText): Deleted.
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::FontCascade::drawComplexText): Deleted.
+ * platform/graphics/win/FontWin.cpp:
+ (WebCore::FontCascade::drawComplexText): Deleted.
+
2015-12-15 Tim Horton <[email protected]>
[Mac] Gesture Events should not have negative scale
Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (194131 => 194132)
--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2015-12-16 05:54:20 UTC (rev 194131)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2015-12-16 06:28:13 UTC (rev 194132)
@@ -306,6 +306,13 @@
m_requiresShaping = computeRequiresShaping();
}
+float FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer) const
+{
+ if (codePathToUse != Complex)
+ return getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer);
+ return getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
+}
+
float FontCascade::drawText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to, CustomFontNotReadyAction customFontNotReadyAction) const
{
// Don't draw anything while we are using custom fonts that are in the process of loading,
@@ -321,10 +328,15 @@
if (codePathToUse != Complex && (enableKerning() || requiresShaping()) && (from || static_cast<unsigned>(to) != run.length()) && !isDrawnWithSVGFont(run))
codePathToUse = Complex;
- if (codePathToUse != Complex)
- return drawSimpleText(context, run, point, from, to);
-
- return drawComplexText(context, run, point, from, to);
+ GlyphBuffer glyphBuffer;
+ float startX = point.x() + glyphBufferForTextRun(codePathToUse, run, from, to, glyphBuffer);
+ // We couldn't generate any glyphs for the run. Give up.
+ if (glyphBuffer.isEmpty())
+ return 0;
+ // Draw the glyph buffer now at the starting point returned in startX.
+ FloatPoint startPoint(startX, point.y());
+ drawGlyphBuffer(context, run, glyphBuffer, startPoint);
+ return startPoint.x() - startX;
}
void FontCascade::drawEmphasisMarks(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
@@ -1292,22 +1304,6 @@
return initialAdvance;
}
-float FontCascade::drawSimpleText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const
-{
- // This glyph buffer holds our glyphs+advances+font data for each glyph.
- GlyphBuffer glyphBuffer;
-
- float startX = point.x() + getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer);
-
- if (glyphBuffer.isEmpty())
- return 0;
-
- FloatPoint startPoint(startX, point.y());
- drawGlyphBuffer(context, run, glyphBuffer, startPoint);
-
- return startPoint.x() - startX;
-}
-
void FontCascade::drawEmphasisMarksForSimpleText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
{
GlyphBuffer glyphBuffer;
Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (194131 => 194132)
--- trunk/Source/WebCore/platform/graphics/FontCascade.h 2015-12-16 05:54:20 UTC (rev 194131)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h 2015-12-16 06:28:13 UTC (rev 194132)
@@ -222,9 +222,9 @@
private:
enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis };
+ float glyphBufferForTextRun(CodePath, const TextRun&, int from, int to, GlyphBuffer&) const;
// Returns the initial in-stream advance.
float getGlyphsAndAdvancesForSimpleText(const TextRun&, int from, int to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
- float drawSimpleText(GraphicsContext&, const TextRun&, const FloatPoint&, int from, int to) const;
void drawEmphasisMarksForSimpleText(GraphicsContext&, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const;
void drawGlyphBuffer(GraphicsContext&, const TextRun&, const GlyphBuffer&, FloatPoint&) const;
void drawEmphasisMarks(GraphicsContext&, const TextRun&, const GlyphBuffer&, const AtomicString&, const FloatPoint&) const;
@@ -239,7 +239,6 @@
// Returns the initial in-stream advance.
float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
- float drawComplexText(GraphicsContext&, const TextRun&, const FloatPoint&, int from, int to) const;
void drawEmphasisMarksForComplexText(GraphicsContext&, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const;
float floatWidthForComplexText(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const;
Modified: trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (194131 => 194132)
--- trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp 2015-12-16 05:54:20 UTC (rev 194131)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp 2015-12-16 06:28:13 UTC (rev 194132)
@@ -52,24 +52,6 @@
return 0;
}
-float FontCascade::drawComplexText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const
-{
- // This glyph buffer holds our glyphs + advances + font data for each glyph.
- GlyphBuffer glyphBuffer;
-
- float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
-
- // We couldn't generate any glyphs for the run. Give up.
- if (glyphBuffer.isEmpty())
- return 0;
-
- // Draw the glyph buffer now at the starting point returned in startX.
- FloatPoint startPoint(startX, point.y());
- drawGlyphBuffer(context, run, glyphBuffer, startPoint);
-
- return startPoint.x() - startX;
-}
-
void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const
{
notImplemented();
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (194131 => 194132)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2015-12-16 05:54:20 UTC (rev 194131)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2015-12-16 06:28:13 UTC (rev 194132)
@@ -642,24 +642,6 @@
return initialAdvance;
}
-float FontCascade::drawComplexText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const
-{
- // This glyph buffer holds our glyphs + advances + font data for each glyph.
- GlyphBuffer glyphBuffer;
-
- float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
-
- // We couldn't generate any glyphs for the run. Give up.
- if (glyphBuffer.isEmpty())
- return 0;
-
- // Draw the glyph buffer now at the starting point returned in startX.
- FloatPoint startPoint(startX, point.y());
- drawGlyphBuffer(context, run, glyphBuffer, startPoint);
-
- return startPoint.x() - startX;
-}
-
void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
{
GlyphBuffer glyphBuffer;
Modified: trunk/Source/WebCore/platform/graphics/win/FontWin.cpp (194131 => 194132)
--- trunk/Source/WebCore/platform/graphics/win/FontWin.cpp 2015-12-16 05:54:20 UTC (rev 194131)
+++ trunk/Source/WebCore/platform/graphics/win/FontWin.cpp 2015-12-16 06:28:13 UTC (rev 194132)
@@ -91,23 +91,6 @@
return beforeWidth;
}
-float FontCascade::drawComplexText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const
-{
- // This glyph buffer holds our glyphs + advances + font data for each glyph.
- GlyphBuffer glyphBuffer;
-
- float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
-
- // We couldn't generate any glyphs for the run. Give up.
- if (glyphBuffer.isEmpty())
- return 0;
-
- // Draw the glyph buffer now at the starting point returned in startX.
- FloatPoint startPoint(startX, point.y());
- drawGlyphBuffer(context, run, glyphBuffer, startPoint);
- return startPoint.x() - startX;
-}
-
void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
{
GlyphBuffer glyphBuffer;