OLD | NEW |
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 FontPlatformData* FontCache::getFontPlatformData( | 101 FontPlatformData* FontCache::getFontPlatformData( |
102 const FontDescription& fontDescription, | 102 const FontDescription& fontDescription, |
103 const FontFaceCreationParams& creationParams, | 103 const FontFaceCreationParams& creationParams, |
104 bool checkingAlternateName) { | 104 bool checkingAlternateName) { |
105 if (!gFontPlatformDataCache) { | 105 if (!gFontPlatformDataCache) { |
106 gFontPlatformDataCache = new FontPlatformDataCache; | 106 gFontPlatformDataCache = new FontPlatformDataCache; |
107 platformInit(); | 107 platformInit(); |
108 } | 108 } |
109 | 109 |
| 110 if (creationParams.creationType() == CreateFontByFamily) { |
| 111 #if OS(MACOSX) |
| 112 if (creationParams.family() == FontCache::legacySystemFontFamily()) { |
| 113 return getFontPlatformData( |
| 114 fontDescription, FontFaceCreationParams(FontFamilyNames::system_ui), |
| 115 true); |
| 116 } |
| 117 #else |
| 118 if (creationParams.family() == FontFamilyNames::system_ui) { |
| 119 const AtomicString& actualFamily = FontCache::systemFontFamily(); |
| 120 #if OS(LINUX) |
| 121 if (actualFamily.isEmpty() || actualFamily == FontFamilyNames::system_ui) |
| 122 return nullptr; |
| 123 #else |
| 124 DCHECK(!actualFamily.isEmpty() && |
| 125 actualFamily != FontFamilyNames::system_ui); |
| 126 #endif |
| 127 return getFontPlatformData(fontDescription, |
| 128 FontFaceCreationParams(actualFamily), true); |
| 129 } |
| 130 #endif |
| 131 } |
| 132 |
110 float size = fontDescription.effectiveFontSize(); | 133 float size = fontDescription.effectiveFontSize(); |
111 unsigned roundedSize = size * FontCacheKey::precisionMultiplier(); | 134 unsigned roundedSize = size * FontCacheKey::precisionMultiplier(); |
112 FontCacheKey key = fontDescription.cacheKey(creationParams); | 135 FontCacheKey key = fontDescription.cacheKey(creationParams); |
113 | 136 |
114 // Remove the font size from the cache key, and handle the font size | 137 // Remove the font size from the cache key, and handle the font size |
115 // separately in the inner HashMap. So that different size of FontPlatformData | 138 // separately in the inner HashMap. So that different size of FontPlatformData |
116 // can share underlying SkTypeface. | 139 // can share underlying SkTypeface. |
117 if (RuntimeEnabledFeatures::fontCacheScalingEnabled()) | 140 if (RuntimeEnabledFeatures::fontCacheScalingEnabled()) |
118 key.clearFontSize(); | 141 key.clearFontSize(); |
119 | 142 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 for (iter = gFallbackListShaperCache->begin(); | 472 for (iter = gFallbackListShaperCache->begin(); |
450 iter != gFallbackListShaperCache->end(); ++iter) { | 473 iter != gFallbackListShaperCache->end(); ++iter) { |
451 shapeResultCacheSize += iter->value->byteSize(); | 474 shapeResultCacheSize += iter->value->byteSize(); |
452 } | 475 } |
453 dump->AddScalar("size", "bytes", shapeResultCacheSize); | 476 dump->AddScalar("size", "bytes", shapeResultCacheSize); |
454 memoryDump->AddSuballocation(dump->guid(), | 477 memoryDump->AddSuballocation(dump->guid(), |
455 WTF::Partitions::kAllocatedObjectPoolName); | 478 WTF::Partitions::kAllocatedObjectPoolName); |
456 } | 479 } |
457 | 480 |
458 } // namespace blink | 481 } // namespace blink |
OLD | NEW |