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

Unified Diff: Source/platform/fonts/CustomFontData.h

Issue 171823002: Make text visible when font loading takes longer than 3 seconds (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 10 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/fetch/FontResource.cpp ('k') | Source/platform/fonts/Font.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/CustomFontData.h
diff --git a/Source/platform/fonts/CustomFontData.h b/Source/platform/fonts/CustomFontData.h
index cb69f5a0c4139ec17ca41c801be45dd44396a673..bb642c155fb1dbb4231036b2b0ab0f3f327fb752 100644
--- a/Source/platform/fonts/CustomFontData.h
+++ b/Source/platform/fonts/CustomFontData.h
@@ -37,9 +37,10 @@ struct WidthIterator;
class PLATFORM_EXPORT CustomFontData : public RefCounted<CustomFontData> {
public:
- static PassRefPtr<CustomFontData> create(bool isLoadingFallback = false)
+ enum FallbackVisibility { InvisibleFallback, VisibleFallback };
+ static PassRefPtr<CustomFontData> create(bool isLoadingFallback = false, FallbackVisibility visibility = VisibleFallback)
{
- return adoptRef(new CustomFontData(isLoadingFallback));
+ return adoptRef(new CustomFontData(isLoadingFallback, visibility));
}
virtual ~CustomFontData() { }
@@ -47,6 +48,7 @@ public:
virtual void beginLoadIfNeeded() const { };
bool isLoading() const { return m_isLoadingFallback && m_isUsed; }
bool isLoadingFallback() const { return m_isLoadingFallback; }
+ bool shouldSkipDrawing() const { return m_fallbackVisibility == InvisibleFallback && m_isUsed; }
virtual bool isSVGFont() const { return false; }
virtual void initializeFontData(SimpleFontData*, float) { }
@@ -58,13 +60,15 @@ public:
virtual void clearCSSFontFaceSource() { }
protected:
- CustomFontData(bool isLoadingFallback)
+ CustomFontData(bool isLoadingFallback, FallbackVisibility visibility = VisibleFallback)
: m_isLoadingFallback(isLoadingFallback)
+ , m_fallbackVisibility(visibility)
, m_isUsed(false)
{
}
- bool m_isLoadingFallback; // Whether or not this is a temporary font data for a custom font which is not yet loaded.
+ bool m_isLoadingFallback;
+ FallbackVisibility m_fallbackVisibility;
mutable bool m_isUsed;
};
« no previous file with comments | « Source/core/fetch/FontResource.cpp ('k') | Source/platform/fonts/Font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698