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

Unified Diff: Source/core/css/CSSFontFace.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/CSSFontFace.h ('k') | Source/core/css/CSSFontFaceSource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSFontFace.cpp
diff --git a/Source/core/css/CSSFontFace.cpp b/Source/core/css/CSSFontFace.cpp
index ecdedb72a15787c8c9a3f18673b6c47712dff3b0..c667aaa185e971517e38224ec58638e912100bbc 100644
--- a/Source/core/css/CSSFontFace.cpp
+++ b/Source/core/css/CSSFontFace.cpp
@@ -67,6 +67,18 @@ void CSSFontFace::setSegmentedFontFace(CSSSegmentedFontFace* segmentedFontFace)
m_segmentedFontFace = segmentedFontFace;
}
+void CSSFontFace::beginLoadingFontSoon(FontResource* resource)
+{
+ if (!m_segmentedFontFace)
+ return;
+
+ CSSFontSelector* fontSelector = m_segmentedFontFace->fontSelector();
+ fontSelector->beginLoadingFontSoon(resource);
+
+ if (loadStatus() == FontFace::Unloaded)
+ setLoadStatus(FontFace::Loading);
+}
+
void CSSFontFace::fontLoaded(CSSFontFaceSource* source)
{
if (source != m_activeSource)
@@ -100,19 +112,20 @@ PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontD
ASSERT(m_segmentedFontFace);
CSSFontSelector* fontSelector = m_segmentedFontFace->fontSelector();
- if (loadStatus() == FontFace::Unloaded)
- setLoadStatus(FontFace::Loading);
-
size_t size = m_sources.size();
for (size_t i = 0; i < size; ++i) {
if (RefPtr<SimpleFontData> result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, fontSelector)) {
m_activeSource = m_sources[i].get();
+ if (loadStatus() == FontFace::Unloaded && (m_sources[i]->isLoading() || m_sources[i]->isLoaded()))
+ setLoadStatus(FontFace::Loading);
if (loadStatus() == FontFace::Loading && m_sources[i]->isLoaded())
setLoadStatus(FontFace::Loaded);
return result.release();
}
}
+ if (loadStatus() == FontFace::Unloaded)
+ setLoadStatus(FontFace::Loading);
if (loadStatus() == FontFace::Loading)
setLoadStatus(FontFace::Error);
return 0;
« no previous file with comments | « Source/core/css/CSSFontFace.h ('k') | Source/core/css/CSSFontFaceSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698