Index: Source/core/css/CSSFontFace.cpp |
diff --git a/Source/core/css/CSSFontFace.cpp b/Source/core/css/CSSFontFace.cpp |
index 40d6fa384799edcf82a9f45b544d7cfef2f287ff..9ae257e4d2bc61f2933c3f3b8282a04823f2b6c0 100644 |
--- a/Source/core/css/CSSFontFace.cpp |
+++ b/Source/core/css/CSSFontFace.cpp |
@@ -126,13 +126,16 @@ |
return nullptr; |
} |
-bool CSSFontFace::maybeScheduleFontLoad(const FontDescription& fontDescription, UChar32 character) |
-{ |
- if (m_ranges.contains(character)) { |
+void CSSFontFace::willUseFontData(const FontDescription& fontDescription) |
+{ |
+ // 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()) |
load(fontDescription); |
- return true; |
- } |
- return false; |
} |
void CSSFontFace::load(const FontDescription& fontDescription, CSSFontSelector* fontSelector) |
@@ -214,14 +217,6 @@ |
m_ranges.shrink(targetIndex); |
} |
-bool CSSFontFace::UnicodeRangeSet::contains(UChar32 c) const |
-{ |
- if (isEntireRange()) |
- return true; |
- Vector<UnicodeRange>::const_iterator it = std::lower_bound(m_ranges.begin(), m_ranges.end(), c); |
- return it != m_ranges.end() && it->contains(c); |
-} |
- |
bool CSSFontFace::UnicodeRangeSet::intersectsWith(const String& text) const |
{ |
if (text.isEmpty()) |
@@ -235,7 +230,8 @@ |
while (index < text.length()) { |
UChar32 c = text.characterStartingAt(index); |
index += U16_LENGTH(c); |
- if (contains(c)) |
+ Vector<UnicodeRange>::const_iterator it = std::lower_bound(m_ranges.begin(), m_ranges.end(), c); |
+ if (it != m_ranges.end() && it->contains(c)) |
return true; |
} |
return false; |