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

Unified Diff: third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp

Issue 1483543002: Always use user preference font before system fallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update bug # for slow expectations Created 5 years 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 | « third_party/WebKit/LayoutTests/http/tests/webfont/fallback-font-while-loading-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp b/third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp
index c287971055c9a2bd28d8081d52a43699d713d3a9..135054105dd09ea4cd39aa128324b880b97a2a56 100644
--- a/third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontFallbackList.cpp
@@ -152,33 +152,23 @@ const SimpleFontData* FontFallbackList::determinePrimarySimpleFontData(const Fon
PassRefPtr<FontData> FontFallbackList::getFontData(const FontDescription& fontDescription, int& familyIndex) const
{
- RefPtr<FontData> result;
-
- int startIndex = familyIndex;
- const FontFamily* startFamily = &fontDescription.family();
- for (int i = 0; startFamily && i < startIndex; i++)
- startFamily = startFamily->next();
- const FontFamily* currFamily = startFamily;
- while (currFamily && !result) {
+ const FontFamily* currFamily = &fontDescription.family();
+ for (int i = 0; currFamily && i < familyIndex; i++)
+ currFamily = currFamily->next();
+
+ for (; currFamily; currFamily = currFamily->next()) {
familyIndex++;
if (currFamily->family().length()) {
+ RefPtr<FontData> result;
if (m_fontSelector)
result = m_fontSelector->getFontData(fontDescription, currFamily->family());
-
if (!result)
result = FontCache::fontCache()->getFontData(fontDescription, currFamily->family());
+ if (result)
+ return result.release();
}
- currFamily = currFamily->next();
}
-
- if (!currFamily)
- familyIndex = cAllFamiliesScanned;
-
- if (result || startIndex)
- return result.release();
-
- // If it's the primary font that we couldn't find, we try the following. In all other cases, we will
- // just use per-character system fallback.
+ familyIndex = cAllFamiliesScanned;
if (m_fontSelector) {
// Try the user's preferred standard font.
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/webfont/fallback-font-while-loading-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698