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

Unified Diff: Source/core/css/CSSFontFaceSource.cpp

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/css/CSSFontFaceSource.h ('k') | Source/core/css/CSSSegmentedFontFace.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSFontFaceSource.cpp
diff --git a/Source/core/css/CSSFontFaceSource.cpp b/Source/core/css/CSSFontFaceSource.cpp
index 264c496a7d841af9b1e8d31db5b6d9281b71e5ef..911f28e83e4ff158c8c902b12a929d15bfa645bb 100644
--- a/Source/core/css/CSSFontFaceSource.cpp
+++ b/Source/core/css/CSSFontFaceSource.cpp
@@ -68,6 +68,10 @@ void CSSFontFaceSource::pruneTable()
if (m_fontDataTable.isEmpty())
return;
+ for (FontDataTable::iterator it = m_fontDataTable.begin(); it != m_fontDataTable.end(); ++it) {
+ if (SimpleFontData* fontData = it->value.get())
+ fontData->clearCSSFontFaceSource();
+ }
m_fontDataTable.clear();
}
@@ -82,6 +86,13 @@ bool CSSFontFaceSource::isLocal() const
return true;
}
+bool CSSFontFaceSource::isLoading() const
+{
+ if (m_font)
+ return !m_font->stillNeedsLoad() && !m_font->isLoaded();
+ return false;
+}
+
bool CSSFontFaceSource::isLoaded() const
{
if (m_font)
@@ -193,14 +204,11 @@ PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription&
#endif
}
} else {
- // Kick off the load. Do it soon rather than now, because we may be in the middle of layout,
- // and the loader may invoke arbitrary delegate or event handler code.
- fontSelector->beginLoadingFontSoon(m_font.get());
-
// This temporary font is not retained and should not be returned.
FontCachePurgePreventer fontCachePurgePreventer;
SimpleFontData* temporaryFont = fontCache()->getNonRetainedLastResortFallbackFont(fontDescription);
fontData = SimpleFontData::create(temporaryFont->platformData(), true, true);
+ fontData->setCSSFontFaceSource(this);
}
return fontData; // No release, because fontData is a reference to a RefPtr that is held in the m_fontDataTable.
@@ -254,6 +262,13 @@ void CSSFontFaceSource::willUseFontData()
m_font->willUseFontData();
}
+void CSSFontFaceSource::beginLoadingFontSoon()
+{
+ ASSERT(m_face);
+ ASSERT(m_font);
+ m_face->beginLoadingFontSoon(m_font.get());
+}
+
void CSSFontFaceSource::FontLoadHistograms::loadStarted()
{
if (!m_loadStartTime)
« no previous file with comments | « Source/core/css/CSSFontFaceSource.h ('k') | Source/core/css/CSSSegmentedFontFace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698