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

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: rebase and add toSegmentedFontData() Created 7 years, 3 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
« no previous file with comments | « Source/core/platform/graphics/SegmentedFontData.h ('k') | Source/core/platform/graphics/SimpleFontData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/graphics/SimpleFontData.h
diff --git a/Source/core/platform/graphics/SimpleFontData.h b/Source/core/platform/graphics/SimpleFontData.h
index 1d0a1ede1102a6ec91b5095b1498938b652f86bc..ebcf8ab2872ec98e31935c563c5987bd40cd27c6 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_customFontData.isLoadingFallback; }
- virtual bool isCustomFont() const { return m_isCustomFont; }
- virtual bool isLoading() const { return m_isLoading; }
+ virtual bool isCustomFont() const { return m_customFontData.isCustomFont; }
+ virtual bool isLoading() const { return m_customFontData.isLoadingFallback && m_customFontData.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_customFontData.fontFaceSource = source; }
+ void clearCSSFontFaceSource() { m_customFontData.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);
@@ -216,8 +223,6 @@ private:
mutable GlyphMetricsMap<float> m_glyphToWidthMap;
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_isTextOrientationFallback;
bool m_isBrokenIdeographFallback;
@@ -258,6 +263,21 @@ private:
mutable OwnPtr<DerivedFontData> m_derivedFontData;
+ struct CustomFontData {
+ CustomFontData(bool isCustomFont, bool isLoadingFallback)
+ : isCustomFont(isCustomFont)
+ , isLoadingFallback(isLoadingFallback)
+ , isUsed(false)
+ , fontFaceSource(0)
+ {
+ }
+ bool isCustomFont; // Whether or not we are custom font loaded via @font-face
+ bool isLoadingFallback; // Whether or not this is a temporary font data for a custom font which is not yet loaded.
+ mutable bool isUsed;
+ CSSFontFaceSource* fontFaceSource;
+ };
+ CustomFontData m_customFontData;
+
#if OS(MACOSX)
float m_syntheticBoldOffset;
« no previous file with comments | « Source/core/platform/graphics/SegmentedFontData.h ('k') | Source/core/platform/graphics/SimpleFontData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698