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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontCache.cpp

Issue 1693563003: Take Accept-Language into account in CJK font fallback for Android/Win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aceept-lang
Patch Set: Fix non-Windows builds Created 4 years, 10 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) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 15 matching lines...) Expand all
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "platform/fonts/FontCache.h" 30 #include "platform/fonts/FontCache.h"
31 31
32 #include "platform/FontFamilyNames.h" 32 #include "platform/FontFamilyNames.h"
33 33
34 #include "platform/Histogram.h" 34 #include "platform/Histogram.h"
35 #include "platform/RuntimeEnabledFeatures.h" 35 #include "platform/RuntimeEnabledFeatures.h"
36 #include "platform/fonts/AcceptLanguagesResolver.h"
36 #include "platform/fonts/AlternateFontFamily.h" 37 #include "platform/fonts/AlternateFontFamily.h"
37 #include "platform/fonts/FontCacheClient.h" 38 #include "platform/fonts/FontCacheClient.h"
38 #include "platform/fonts/FontCacheKey.h" 39 #include "platform/fonts/FontCacheKey.h"
39 #include "platform/fonts/FontDataCache.h" 40 #include "platform/fonts/FontDataCache.h"
40 #include "platform/fonts/FontDescription.h" 41 #include "platform/fonts/FontDescription.h"
41 #include "platform/fonts/FontPlatformData.h" 42 #include "platform/fonts/FontPlatformData.h"
42 #include "platform/fonts/FontSmoothingMode.h" 43 #include "platform/fonts/FontSmoothingMode.h"
43 #include "platform/fonts/SimpleFontData.h" 44 #include "platform/fonts/SimpleFontData.h"
44 #include "platform/fonts/TextRenderingMode.h" 45 #include "platform/fonts/TextRenderingMode.h"
45 #include "platform/fonts/opentype/OpenTypeVerticalData.h" 46 #include "platform/fonts/opentype/OpenTypeVerticalData.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (result != fontVerticalDataCache.end()) 155 if (result != fontVerticalDataCache.end())
155 return result.get()->value; 156 return result.get()->value;
156 157
157 RefPtr<OpenTypeVerticalData> verticalData = OpenTypeVerticalData::create(pla tformData); 158 RefPtr<OpenTypeVerticalData> verticalData = OpenTypeVerticalData::create(pla tformData);
158 if (!verticalData->isOpenType()) 159 if (!verticalData->isOpenType())
159 verticalData.clear(); 160 verticalData.clear();
160 fontVerticalDataCache.set(key, verticalData); 161 fontVerticalDataCache.set(key, verticalData);
161 return verticalData; 162 return verticalData;
162 } 163 }
163 164
165 void FontCache::acceptLanguagesChanged(const String& acceptLanguages)
166 {
167 AcceptLanguagesResolver::acceptLanguagesChanged(acceptLanguages);
168 }
169
164 static FontDataCache* gFontDataCache = 0; 170 static FontDataCache* gFontDataCache = 0;
165 171
166 PassRefPtr<SimpleFontData> FontCache::getFontData(const FontDescription& fontDes cription, const AtomicString& family, bool checkingAlternateName, ShouldRetain s houldRetain) 172 PassRefPtr<SimpleFontData> FontCache::getFontData(const FontDescription& fontDes cription, const AtomicString& family, bool checkingAlternateName, ShouldRetain s houldRetain)
167 { 173 {
168 if (FontPlatformData* platformData = getFontPlatformData(fontDescription, Fo ntFaceCreationParams(adjustFamilyNameToAvoidUnsupportedFonts(family)), checkingA lternateName)) 174 if (FontPlatformData* platformData = getFontPlatformData(fontDescription, Fo ntFaceCreationParams(adjustFamilyNameToAvoidUnsupportedFonts(family)), checkingA lternateName))
169 return fontDataFromFontPlatformData(platformData, shouldRetain); 175 return fontDataFromFontPlatformData(platformData, shouldRetain);
170 176
171 return nullptr; 177 return nullptr;
172 } 178 }
173 179
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 iter != gFallbackListShaperCache->end(); 400 iter != gFallbackListShaperCache->end();
395 ++iter) { 401 ++iter) {
396 shapeResultCacheSize += iter->value->byteSize(); 402 shapeResultCacheSize += iter->value->byteSize();
397 } 403 }
398 dump->addScalar("size", "bytes", shapeResultCacheSize); 404 dump->addScalar("size", "bytes", shapeResultCacheSize);
399 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate dObjectPoolName)); 405 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate dObjectPoolName));
400 } 406 }
401 407
402 408
403 } // namespace blink 409 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698