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

Unified Diff: Source/platform/fonts/FontFallbackList.cpp

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/platform/fonts/FontFallbackList.h ('k') | Source/platform/fonts/SegmentedFontData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/FontFallbackList.cpp
diff --git a/Source/platform/fonts/FontFallbackList.cpp b/Source/platform/fonts/FontFallbackList.cpp
index 2397099d3c5290e93dfd7eed3ef854765a3e05fb..39d393904288724e775bd98a7d67a57fb1a8aa77 100644
--- a/Source/platform/fonts/FontFallbackList.cpp
+++ b/Source/platform/fonts/FontFallbackList.cpp
@@ -45,7 +45,7 @@ FontFallbackList::FontFallbackList()
, m_familyIndex(0)
, m_generation(FontCache::fontCache()->generation())
, m_pitch(UnknownPitch)
- , m_loadingCustomFonts(false)
+ , m_hasLoadingFallback(false)
{
}
@@ -58,7 +58,7 @@ void FontFallbackList::invalidate(PassRefPtr<FontSelector> fontSelector)
m_cachedPrimarySimpleFontData = 0;
m_familyIndex = 0;
m_pitch = UnknownPitch;
- m_loadingCustomFonts = false;
+ m_hasLoadingFallback = false;
m_fontSelector = fontSelector;
m_fontSelectorVersion = m_fontSelector ? m_fontSelector->version() : 0;
m_generation = FontCache::fontCache()->generation();
@@ -93,15 +93,26 @@ void FontFallbackList::determinePitch(const FontDescription& fontDescription) co
bool FontFallbackList::loadingCustomFonts() const
{
- if (m_loadingCustomFonts)
- return true;
+ if (!m_hasLoadingFallback)
+ return false;
unsigned numFonts = m_fontList.size();
for (unsigned i = 0; i < numFonts; ++i) {
- if (m_fontList[i]->isCustomFont() && m_fontList[i]->isLoading()) {
- m_loadingCustomFonts = true;
+ if (m_fontList[i]->isLoading())
+ return true;
+ }
+ return false;
+}
+
+bool FontFallbackList::shouldSkipDrawing() const
+{
+ if (!m_hasLoadingFallback)
+ return false;
+
+ unsigned numFonts = m_fontList.size();
+ for (unsigned i = 0; i < numFonts; ++i) {
+ if (m_fontList[i]->shouldSkipDrawing())
return true;
- }
}
return false;
}
@@ -199,8 +210,8 @@ const FontData* FontFallbackList::fontDataAt(const FontDescription& fontDescript
RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex);
if (result) {
m_fontList.append(result);
- if (result->isLoading())
- m_loadingCustomFonts = true;
+ if (result->isLoadingFallback())
+ m_hasLoadingFallback = true;
}
return result.get();
}
« no previous file with comments | « Source/platform/fonts/FontFallbackList.h ('k') | Source/platform/fonts/SegmentedFontData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698