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

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

Issue 24622002: Workaround font preference in CJK DOM locales (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test Created 7 years, 2 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
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (!document || !document->frame()) 163 if (!document || !document->frame())
164 return 0; 164 return 0;
165 165
166 const Settings* settings = document->frame()->settings(); 166 const Settings* settings = document->frame()->settings();
167 if (!settings) 167 if (!settings)
168 return 0; 168 return 0;
169 169
170 AtomicString genericFamily; 170 AtomicString genericFamily;
171 UScriptCode script = fontDescription.script(); 171 UScriptCode script = fontDescription.script();
172 172
173 #if OS(ANDROID)
174 genericFamily = FontCache::getGenericFamilyNameForScript(familyName, script) ;
175 #else
173 if (familyName == serifFamily) 176 if (familyName == serifFamily)
174 genericFamily = settings->serifFontFamily(script); 177 genericFamily = settings->serifFontFamily(script);
175 else if (familyName == sansSerifFamily) 178 else if (familyName == sansSerifFamily)
176 genericFamily = settings->sansSerifFontFamily(script); 179 genericFamily = settings->sansSerifFontFamily(script);
177 else if (familyName == cursiveFamily) 180 else if (familyName == cursiveFamily)
178 genericFamily = settings->cursiveFontFamily(script); 181 genericFamily = settings->cursiveFontFamily(script);
179 else if (familyName == fantasyFamily) 182 else if (familyName == fantasyFamily)
180 genericFamily = settings->fantasyFontFamily(script); 183 genericFamily = settings->fantasyFontFamily(script);
181 else if (familyName == monospaceFamily) 184 else if (familyName == monospaceFamily)
182 genericFamily = settings->fixedFontFamily(script); 185 genericFamily = settings->fixedFontFamily(script);
183 else if (familyName == pictographFamily) 186 else if (familyName == pictographFamily)
184 genericFamily = settings->pictographFontFamily(script); 187 genericFamily = settings->pictographFontFamily(script);
185 else if (familyName == standardFamily) 188 else if (familyName == standardFamily)
186 genericFamily = settings->standardFontFamily(script); 189 genericFamily = settings->standardFontFamily(script);
190 #endif
187 191
188 if (!genericFamily.isEmpty()) 192 if (!genericFamily.isEmpty())
189 return fontCache()->getFontResourceData(fontDescription, genericFamily); 193 return fontCache()->getFontResourceData(fontDescription, genericFamily);
190 194
191 return 0; 195 return 0;
192 } 196 }
193 197
194 static inline bool compareFontFaces(CSSSegmentedFontFace* first, CSSSegmentedFon tFace* second, FontTraitsMask desiredTraitsMask) 198 static inline bool compareFontFaces(CSSSegmentedFontFace* first, CSSSegmentedFon tFace* second, FontTraitsMask desiredTraitsMask)
195 { 199 {
196 FontTraitsMask firstTraitsMask = first->traitsMask(); 200 FontTraitsMask firstTraitsMask = first->traitsMask();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 404 }
401 // Ensure that if the request count reaches zero, the frame loader will know about it. 405 // Ensure that if the request count reaches zero, the frame loader will know about it.
402 fetcher->didLoadResource(0); 406 fetcher->didLoadResource(0);
403 // New font loads may be triggered by layout after the document load is comp lete but before we have dispatched 407 // New font loads may be triggered by layout after the document load is comp lete but before we have dispatched
404 // didFinishLoading for the frame. Make sure the delegate is always dispatch ed by checking explicitly. 408 // didFinishLoading for the frame. Make sure the delegate is always dispatch ed by checking explicitly.
405 if (m_document && m_document->frame()) 409 if (m_document && m_document->frame())
406 m_document->frame()->loader()->checkLoadComplete(); 410 m_document->frame()->loader()->checkLoadComplete();
407 } 411 }
408 412
409 } 413 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698