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