Bug 61646

Summary: Duplicate Fonts Put in Font Cache on Mac Due to Duplicate CGFontRefs for Same Font
Product: WebKit Reporter: Michael Saboff <msaboff>
Component: WebCore Misc.Assignee: Michael Saboff <msaboff>
Status: RESOLVED FIXED    
Severity: Major CC: aroben
Priority: P1 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Macintosh   
OS: All   
Attachments:
Description Flags
Patch to only compare the CGFontRefs if needed hyatt: review+

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>