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

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

Issue 2392033002: Correcting text baseline for tiny fonts (Closed)
Patch Set: Rebaseline. Created 4 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) 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 static FontDataCache* gFontDataCache = 0; 242 static FontDataCache* gFontDataCache = 0;
243 243
244 PassRefPtr<SimpleFontData> FontCache::getFontData( 244 PassRefPtr<SimpleFontData> FontCache::getFontData(
245 const FontDescription& fontDescription, 245 const FontDescription& fontDescription,
246 const AtomicString& family, 246 const AtomicString& family,
247 bool checkingAlternateName, 247 bool checkingAlternateName,
248 ShouldRetain shouldRetain) { 248 ShouldRetain shouldRetain) {
249 if (FontPlatformData* platformData = getFontPlatformData( 249 if (FontPlatformData* platformData = getFontPlatformData(
250 fontDescription, FontFaceCreationParams( 250 fontDescription, FontFaceCreationParams(
251 adjustFamilyNameToAvoidUnsupportedFonts(family)), 251 adjustFamilyNameToAvoidUnsupportedFonts(family)),
252 checkingAlternateName)) 252 checkingAlternateName)) {
253 return fontDataFromFontPlatformData(platformData, shouldRetain); 253 return fontDataFromFontPlatformData(
254 platformData, shouldRetain, fontDescription.subpixelAscentDescent());
255 }
254 256
255 return nullptr; 257 return nullptr;
256 } 258 }
257 259
258 PassRefPtr<SimpleFontData> FontCache::fontDataFromFontPlatformData( 260 PassRefPtr<SimpleFontData> FontCache::fontDataFromFontPlatformData(
259 const FontPlatformData* platformData, 261 const FontPlatformData* platformData,
260 ShouldRetain shouldRetain) { 262 ShouldRetain shouldRetain,
263 bool subpixelAscentDescent) {
261 if (!gFontDataCache) 264 if (!gFontDataCache)
262 gFontDataCache = new FontDataCache; 265 gFontDataCache = new FontDataCache;
263 266
264 #if ENABLE(ASSERT) 267 #if ENABLE(ASSERT)
265 if (shouldRetain == DoNotRetain) 268 if (shouldRetain == DoNotRetain)
266 ASSERT(m_purgePreventCount); 269 ASSERT(m_purgePreventCount);
267 #endif 270 #endif
268 271
269 return gFontDataCache->get(platformData, shouldRetain); 272 return gFontDataCache->get(platformData, shouldRetain, subpixelAscentDescent);
270 } 273 }
271 274
272 bool FontCache::isPlatformFontAvailable(const FontDescription& fontDescription, 275 bool FontCache::isPlatformFontAvailable(const FontDescription& fontDescription,
273 const AtomicString& family) { 276 const AtomicString& family) {
274 bool checkingAlternateName = true; 277 bool checkingAlternateName = true;
275 return getFontPlatformData( 278 return getFontPlatformData(
276 fontDescription, 279 fontDescription,
277 FontFaceCreationParams(adjustFamilyNameToAvoidUnsupportedFonts(family)), 280 FontFaceCreationParams(adjustFamilyNameToAvoidUnsupportedFonts(family)),
278 checkingAlternateName); 281 checkingAlternateName);
279 } 282 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 for (iter = gFallbackListShaperCache->begin(); 452 for (iter = gFallbackListShaperCache->begin();
450 iter != gFallbackListShaperCache->end(); ++iter) { 453 iter != gFallbackListShaperCache->end(); ++iter) {
451 shapeResultCacheSize += iter->value->byteSize(); 454 shapeResultCacheSize += iter->value->byteSize();
452 } 455 }
453 dump->AddScalar("size", "bytes", shapeResultCacheSize); 456 dump->AddScalar("size", "bytes", shapeResultCacheSize);
454 memoryDump->AddSuballocation(dump->guid(), 457 memoryDump->AddSuballocation(dump->guid(),
455 WTF::Partitions::kAllocatedObjectPoolName); 458 WTF::Partitions::kAllocatedObjectPoolName);
456 } 459 }
457 460
458 } // namespace blink 461 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698