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

Side by Side Diff: Source/core/css/CSSFontSelector.cpp

Issue 184703003: Fix generic font family issue on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/platform/android/fast/text/international/non-generic-font-fallback-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 void CSSFontSelector::fontCacheInvalidated() 150 void CSSFontSelector::fontCacheInvalidated()
151 { 151 {
152 dispatchInvalidationCallbacks(); 152 dispatchInvalidationCallbacks();
153 } 153 }
154 154
155 static AtomicString familyNameFromSettings(const GenericFontFamilySettings& sett ings, const FontDescription& fontDescription, const AtomicString& genericFamilyN ame) 155 static AtomicString familyNameFromSettings(const GenericFontFamilySettings& sett ings, const FontDescription& fontDescription, const AtomicString& genericFamilyN ame)
156 { 156 {
157 UScriptCode script = fontDescription.script(); 157 UScriptCode script = fontDescription.script();
158 158
159 #if OS(ANDROID)
160 if (fontDescription.genericFamily() == FontDescription::StandardFamily && !f ontDescription.isSpecifiedFont())
161 return FontCache::getGenericFamilyNameForScript(FontFamilyNames::webkit_ standard, script);
dglazkov 2014/02/28 21:30:30 This is okay, but can we not instead unfork this c
Xianzhu 2014/02/28 22:15:12 FontCache::getFontFamilyForCharacter doesn't actua
162
163 if (genericFamilyName.startsWith("-webkit-"))
164 return FontCache::getGenericFamilyNameForScript(genericFamilyName, scrip t);
165 #else
159 if (fontDescription.genericFamily() == FontDescription::StandardFamily && !f ontDescription.isSpecifiedFont()) 166 if (fontDescription.genericFamily() == FontDescription::StandardFamily && !f ontDescription.isSpecifiedFont())
160 return settings.standard(script); 167 return settings.standard(script);
161
162 #if OS(ANDROID)
163 return FontCache::getGenericFamilyNameForScript(genericFamilyName, script);
164 #else
165 if (genericFamilyName == FontFamilyNames::webkit_serif) 168 if (genericFamilyName == FontFamilyNames::webkit_serif)
166 return settings.serif(script); 169 return settings.serif(script);
167 if (genericFamilyName == FontFamilyNames::webkit_sans_serif) 170 if (genericFamilyName == FontFamilyNames::webkit_sans_serif)
168 return settings.sansSerif(script); 171 return settings.sansSerif(script);
169 if (genericFamilyName == FontFamilyNames::webkit_cursive) 172 if (genericFamilyName == FontFamilyNames::webkit_cursive)
170 return settings.cursive(script); 173 return settings.cursive(script);
171 if (genericFamilyName == FontFamilyNames::webkit_fantasy) 174 if (genericFamilyName == FontFamilyNames::webkit_fantasy)
172 return settings.fantasy(script); 175 return settings.fantasy(script);
173 if (genericFamilyName == FontFamilyNames::webkit_monospace) 176 if (genericFamilyName == FontFamilyNames::webkit_monospace)
174 return settings.fixed(script); 177 return settings.fixed(script);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 m_fontLoader.loadPendingFonts(); 219 m_fontLoader.loadPendingFonts();
217 } 220 }
218 221
219 void CSSFontSelector::updateGenericFontFamilySettings(Document& document) 222 void CSSFontSelector::updateGenericFontFamilySettings(Document& document)
220 { 223 {
221 ASSERT(document.settings()); 224 ASSERT(document.settings());
222 m_genericFontFamilySettings = document.settings()->genericFontFamilySettings (); 225 m_genericFontFamilySettings = document.settings()->genericFontFamilySettings ();
223 } 226 }
224 227
225 } 228 }
OLDNEW
« no previous file with comments | « LayoutTests/platform/android/fast/text/international/non-generic-font-fallback-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698