Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Unified Diff: Source/core/platform/graphics/SimpleFontData.h

Issue 23446007: Use unicode-range to prevent unnecessary @font-face donwnloads (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/graphics/SimpleFontData.h
diff --git a/Source/core/platform/graphics/SimpleFontData.h b/Source/core/platform/graphics/SimpleFontData.h
index 8b15f55d8a657196138ebfae1463c081c32ec65a..d9047841ae7c78799ab95f52d78b118210a3ee02 100644
--- a/Source/core/platform/graphics/SimpleFontData.h
+++ b/Source/core/platform/graphics/SimpleFontData.h
@@ -47,6 +47,7 @@
namespace WebCore {
+class CSSFontFaceSource;
class FontDescription;
class SharedBuffer;
struct WidthIterator;
@@ -68,9 +69,9 @@ public:
};
// Used to create platform fonts.
- static PassRefPtr<SimpleFontData> create(const FontPlatformData& platformData, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false)
+ static PassRefPtr<SimpleFontData> create(const FontPlatformData& platformData, bool isCustomFont = false, bool isLoadingFallback = false, bool isTextOrientationFallback = false)
{
- return adoptRef(new SimpleFontData(platformData, isCustomFont, isLoading, isTextOrientationFallback));
+ return adoptRef(new SimpleFontData(platformData, isCustomFont, isLoadingFallback, isTextOrientationFallback));
}
// Used to create SVG Fonts.
@@ -156,14 +157,17 @@ public:
AdditionalFontData* fontData() const { return m_fontData.get(); }
bool isSVGFont() const { return m_fontData; }
+ bool isLoadingFallback() const { return m_isLoadingFallback; }
virtual bool isCustomFont() const { return m_isCustomFont; }
- virtual bool isLoading() const { return m_isLoading; }
+ virtual bool isLoading() const { return m_isLoadingFallback && m_isUsed; }
virtual bool isSegmented() const;
const GlyphData& missingGlyphData() const { return m_missingGlyphData; }
void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; }
+ void beginLoadIfNeeded() const;
+
#ifndef NDEBUG
virtual String description() const;
#endif
@@ -190,8 +194,11 @@ public:
return false;
}
+ void setCSSFontFaceSource(CSSFontFaceSource* source) { m_fontFaceSource = source; }
+ void clearCSSFontFaceSource() { m_fontFaceSource = 0; }
+
private:
- SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false);
+ SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoadingFallback = false, bool isTextOrientationFallback = false);
SimpleFontData(PassOwnPtr<AdditionalFontData> , float fontSize, bool syntheticBold, bool syntheticItalic);
@@ -217,7 +224,7 @@ private:
bool m_treatAsFixedPitch;
bool m_isCustomFont; // Whether or not we are custom font loaded via @font-face
- bool m_isLoading; // Whether or not this custom font is still in the act of loading.
+ bool m_isLoadingFallback; // Whether or not this is a temporary font data for a custom font which is not yet loaded.
bool m_isTextOrientationFallback;
bool m_isBrokenIdeographFallback;
@@ -258,6 +265,9 @@ private:
mutable OwnPtr<DerivedFontData> m_derivedFontData;
+ mutable bool m_isUsed;
eseidel 2013/09/10 15:07:26 I see. Normally we don't have non-used SimpleFont
Kunihiko Sakamoto 2013/09/11 13:28:09 Thanks for the suggestion. Moved these fields to a
+ CSSFontFaceSource* m_fontFaceSource;
+
#if OS(DARWIN)
float m_syntheticBoldOffset;

Powered by Google App Engine
This is Rietveld 408576698