Chromium Code Reviews| Index: Source/core/css/CSSFontFace.cpp |
| diff --git a/Source/core/css/CSSFontFace.cpp b/Source/core/css/CSSFontFace.cpp |
| index 960eb6045ecc6725779776f5161192588bdb218e..1a62acb9f9439468aa41d584a9888c9e2f2ae775 100644 |
| --- a/Source/core/css/CSSFontFace.cpp |
| +++ b/Source/core/css/CSSFontFace.cpp |
| @@ -84,6 +84,7 @@ void CSSFontFace::fontLoaded(CSSFontFaceSource* source) |
| { |
| if (source != m_activeSource) |
| return; |
| + m_activeSource = 0; |
| // FIXME: Can we assert that m_segmentedFontFace is non-null? That may |
| // require stopping in-progress font loading when the last |
| @@ -137,7 +138,16 @@ PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontD |
| void CSSFontFace::willUseFontData(const FontDescription& fontDescription) |
| { |
| - if (loadStatus() != FontFace::Unloaded) |
| + if (loadStatus() != FontFace::Unloaded || m_activeSource) |
| + return; |
| + |
| + // Kicks off font load here only if the @font-face has no unicode-range. |
| + // @font-faces with unicode-range will be loaded when a GlyphPage for the |
| + // font is created. |
| + // FIXME: Pass around the text to render from RenderText, and kick download |
| + // if m_ranges intersects with the text. Make sure this does not cause |
| + // performance regression. |
| + if (!m_ranges.isEntireRange()) |
| return; |
| ASSERT(m_segmentedFontFace); |
| @@ -146,8 +156,10 @@ void CSSFontFace::willUseFontData(const FontDescription& fontDescription) |
| for (size_t i = 0; i < size; ++i) { |
| if (!m_sources[i]->isValid() || (m_sources[i]->isLocal() && !m_sources[i]->isLocalFontAvailable(fontDescription))) |
| continue; |
| - if (!m_sources[i]->isLocal()) |
| + if (!m_sources[i]->isLocal()) { |
| + m_activeSource = m_sources[i].get(); |
|
dglazkov
2013/11/12 17:58:56
As an aside, I am struggling to understand the pur
|
| m_sources[i]->willUseFontData(); |
| + } |
| break; |
| } |
| } |
| @@ -180,8 +192,8 @@ bool CSSFontFace::UnicodeRangeSet::intersectsWith(const String& text) const |
| { |
| if (text.isEmpty()) |
| return false; |
| - if (m_ranges.isEmpty()) |
| - return true; // Empty UnicodeRangeSet represents the whole code space. |
| + if (isEntireRange()) |
| + return true; |
| // FIXME: This takes O(text.length() * m_ranges.size()) time. It would be |
| // better to make m_ranges sorted and use binary search. |