Bug 61646 - Duplicate Fonts Put in Font Cache on Mac Due to Duplicate CGFontRefs for Same Font
Summary: Duplicate Fonts Put in Font Cache on Mac Due to Duplicate CGFontRefs for Same...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac All
: P1 Major
Assignee: Michael Saboff
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-05-27 10:14 PDT by Michael Saboff
Modified: 2011-05-27 10:52 PDT (History)
1 user (show)

See Also:


Attachments
Patch to only compare the CGFontRefs if needed (1.49 KB, patch)
2011-05-27 10:20 PDT, Michael Saboff
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 2011-05-27 10:14:15 PDT
Core Text has code paths that call into CGFontCreateFontsWithPath() directly, bypassing CG’s font database. This can and does (in TOT WebKit, for example) result in multiple distinct CGFont objects being created for the exact same font.  See <rdar://problem/9089228>for details. Every time we get a new and distinct CGFontRef, we create a new FontCache entry and abandon the old one.

The cache fails to find the earlier entry due to FontPlatformData::platformIsEqual() in FontPlatformDataCocoa.mm comparing the saved m_cfFont.
Comment 1 Michael Saboff 2011-05-27 10:20:40 PDT
Created attachment 95189 [details]
Patch to only compare the CGFontRefs if needed
Comment 2 Michael Saboff 2011-05-27 10:28:54 PDT
<rdar://problem/9515696>
Comment 3 Adam Roben (:aroben) 2011-05-27 10:43:10 PDT
Comment on attachment 95189 [details]
Patch to only compare the CGFontRefs if needed

View in context: https://bugs.webkit.org/attachment.cgi?id=95189&action=review

> Source/WebCore/ChangeLog:9
> +        Change the platformIsEqual to just compare the m_font members if
> +        both are not null.

This doesn't match the code change. We compare the m_font members if either one is not null, not if both are not null.
Comment 4 Dave Hyatt 2011-05-27 10:47:54 PDT
Comment on attachment 95189 [details]
Patch to only compare the CGFontRefs if needed

r=me
Comment 5 Michael Saboff 2011-05-27 10:52:19 PDT
Committed r87524: <http://trac.webkit.org/changeset/87524>