Index: Source/platform/fonts/Font.cpp |
diff --git a/Source/platform/fonts/Font.cpp b/Source/platform/fonts/Font.cpp |
index aa087069dcd1202865b9e157dacb175a2be0e576..7c19b34c86a0a57a12b43038013548d1eddc9bcf 100644 |
--- a/Source/platform/fonts/Font.cpp |
+++ b/Source/platform/fonts/Font.cpp |
@@ -62,6 +62,7 @@ Font::Font(const FontDescription& fd) |
: m_fontDescription(fd) |
, m_canShapeWordByWord(0) |
, m_shapeWordByWordComputed(0) |
+ , m_firstPaintReported(0) |
{ |
} |
@@ -70,6 +71,7 @@ Font::Font(const Font& other) |
, m_fontFallbackList(other.m_fontFallbackList) |
, m_canShapeWordByWord(0) |
, m_shapeWordByWordComputed(0) |
+ , m_firstPaintReported(0) |
{ |
} |
@@ -79,6 +81,7 @@ Font& Font::operator=(const Font& other) |
m_fontFallbackList = other.m_fontFallbackList; |
m_canShapeWordByWord = other.m_canShapeWordByWord; |
m_shapeWordByWordComputed = other.m_shapeWordByWordComputed; |
+ m_firstPaintReported = other.m_firstPaintReported; |
return *this; |
} |
@@ -143,6 +146,8 @@ void Font::drawText(SkCanvas* canvas, const TextRunPaintInfo& runInfo, |
if (shouldSkipDrawing()) |
return; |
+ reportFirstTextPaint(); |
+ |
if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) { |
// we have a pre-cached blob -- happy joy! |
drawTextBlob(canvas, paint, runInfo.cachedTextBlob->get(), point.data()); |
@@ -163,6 +168,8 @@ void Font::drawBidiText(SkCanvas* canvas, const TextRunPaintInfo& runInfo, const |
if (shouldSkipDrawing() && customFontNotReadyAction == DoNotPaintIfFontNotReady) |
return; |
+ reportFirstTextPaint(); |
+ |
// sub-run painting is not supported for Bidi text. |
const TextRun& run = runInfo.run; |
ASSERT((runInfo.from == 0) && (runInfo.to == run.length())); |
@@ -201,6 +208,17 @@ void Font::drawBidiText(SkCanvas* canvas, const TextRunPaintInfo& runInfo, const |
bidiRuns.deleteRuns(); |
} |
+void Font::reportFirstTextPaint() const |
+{ |
+ if (m_firstPaintReported || !fontSelector()) |
+ return; |
+ m_firstPaintReported = true; |
+ |
+ if (m_fontFallbackList->hasCustomFont()) |
+ fontSelector()->reportFirstCustomFontText(); |
+ fontSelector()->reportFirstNonBlankText(); |
+} |
+ |
void Font::drawEmphasisMarks(SkCanvas* canvas, const TextRunPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point, float deviceScaleFactor, const SkPaint& paint) const |
{ |
if (shouldSkipDrawing()) |