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

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

Issue 261753011: Revert of Make CSSFontFace::willUseFontData() load fonts with unicode-range (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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/CSSFontSelector.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 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;
« no previous file with comments | « Source/core/css/CSSFontFace.h ('k') | Source/core/css/CSSFontSelector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698