Chromium Code Reviews| Index: Source/core/platform/graphics/SimpleFontData.cpp |
| diff --git a/Source/core/platform/graphics/SimpleFontData.cpp b/Source/core/platform/graphics/SimpleFontData.cpp |
| index 7276f15eea7fdf515f590afe3cdb671ab0e07bdb..9f838cef57cb3991c89f0eb7db58db0fd7529611 100644 |
| --- a/Source/core/platform/graphics/SimpleFontData.cpp |
| +++ b/Source/core/platform/graphics/SimpleFontData.cpp |
| @@ -30,6 +30,7 @@ |
| #include "config.h" |
| #include "core/platform/graphics/SimpleFontData.h" |
| +#include "core/css/CSSFontFaceSource.h" |
| #include "core/platform/graphics/opentype/OpenTypeVerticalData.h" |
| #include "wtf/MathExtras.h" |
| @@ -42,19 +43,21 @@ namespace WebCore { |
| const float smallCapsFontSizeMultiplier = 0.7f; |
| const float emphasisMarkFontSizeMultiplier = 0.5f; |
| -SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoading, bool isTextOrientationFallback) |
| +SimpleFontData::SimpleFontData(const FontPlatformData& platformData, bool isCustomFont, bool isLoadingFallback, bool isTextOrientationFallback) |
| : m_maxCharWidth(-1) |
| , m_avgCharWidth(-1) |
| , m_platformData(platformData) |
| , m_treatAsFixedPitch(false) |
| , m_isCustomFont(isCustomFont) |
| - , m_isLoading(isLoading) |
| + , m_isLoadingFallback(isLoadingFallback) |
| , m_isTextOrientationFallback(isTextOrientationFallback) |
| , m_isBrokenIdeographFallback(false) |
| #if ENABLE(OPENTYPE_VERTICAL) |
| , m_verticalData(0) |
| #endif |
| , m_hasVerticalGlyphs(false) |
| + , m_isUsed(false) |
|
eseidel
2013/09/10 15:07:26
We should make this name more explicit so that we
Kunihiko Sakamoto
2013/09/11 13:28:09
Now it's m_customFontData.isUsed.
|
| + , m_fontFaceSource(0) |
| { |
| platformInit(); |
| platformGlyphInit(); |
| @@ -72,13 +75,15 @@ SimpleFontData::SimpleFontData(PassOwnPtr<AdditionalFontData> fontData, float fo |
| , m_fontData(fontData) |
| , m_treatAsFixedPitch(false) |
| , m_isCustomFont(true) |
| - , m_isLoading(false) |
| + , m_isLoadingFallback(false) |
| , m_isTextOrientationFallback(false) |
| , m_isBrokenIdeographFallback(false) |
| #if ENABLE(OPENTYPE_VERTICAL) |
| , m_verticalData(0) |
| #endif |
| , m_hasVerticalGlyphs(false) |
| + , m_isUsed(false) |
| + , m_fontFaceSource(0) |
| { |
| m_fontData->initializeFontData(this, fontSize); |
| } |
| @@ -226,6 +231,14 @@ PassRefPtr<SimpleFontData> SimpleFontData::brokenIdeographFontData() const |
| return m_derivedFontData->brokenIdeograph; |
| } |
| +void SimpleFontData::beginLoadIfNeeded() const |
| +{ |
| + if (!m_isUsed && m_isLoadingFallback && m_fontFaceSource) { |
| + m_isUsed = true; |
| + m_fontFaceSource->beginLoadingFontSoon(); |
| + } |
| +} |
| + |
| #ifndef NDEBUG |
| String SimpleFontData::description() const |
| { |