WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
132030
[OS X] Make checking if a font is the system font more robust
https://bugs.webkit.org/show_bug.cgi?id=132030
Summary
[OS X] Make checking if a font is the system font more robust
Myles C. Maxfield
Reported
2014-04-22 17:01:38 PDT
[OS X] Make checking if a font is the system font more robust
Attachments
Patch
(3.97 KB, patch)
2014-04-22 17:07 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(3.77 KB, patch)
2014-04-22 21:09 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(3.91 KB, patch)
2014-04-23 14:25 PDT
,
Myles C. Maxfield
darin
: review-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Myles C. Maxfield
Comment 1
2014-04-22 17:07:08 PDT
Created
attachment 229925
[details]
Patch
Dean Jackson
Comment 2
2014-04-22 17:36:12 PDT
Comment on
attachment 229925
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=229925&action=review
> Source/WebCore/platform/graphics/mac/FontMac.mm:40 > +extern "C" bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
Do we want to wrap this in a #if __MAC_MIN thing as well, to make it clear we only use it on 1090+?
> Source/WebCore/platform/graphics/mac/FontMac.mm:545 > +#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1090
So this existed on 10.9 as well?
Tim Horton
Comment 3
2014-04-22 17:45:54 PDT
Comment on
attachment 229925
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=229925&action=review
> Source/WebCore/platform/graphics/mac/FontMac.mm:37 > +#if defined(__has_include) && __has_include(<CoreText/CTFontDescriptorPriv.h>)
we don't need the defined() part
> Source/WebCore/platform/graphics/mac/FontMac.mm:548 > + return firstFamily().startsWith('.');
does this actually make sense on any platform? were there dot-prefixed fonts in 10.8?
Myles C. Maxfield
Comment 4
2014-04-22 21:07:23 PDT
Comment on
attachment 229925
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=229925&action=review
>> Source/WebCore/platform/graphics/mac/FontMac.mm:37 >> +#if defined(__has_include) && __has_include(<CoreText/CTFontDescriptorPriv.h>) > > we don't need the defined() part
Done.
>> Source/WebCore/platform/graphics/mac/FontMac.mm:40 >> +extern "C" bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef); > > Do we want to wrap this in a #if __MAC_MIN thing as well, to make it clear we only use it on 1090+?
I actually feel like this would do more harm than good. It would add more preprocessor bloat, and wouldn't actually be very valuable. There are many places in WebKit where functions are declared, yet never used or defined. Therefore, seeing a function declaration already doesn't necessarily mean that we ever use it.
>> Source/WebCore/platform/graphics/mac/FontMac.mm:545 >> +#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1090 > > So this existed on 10.9 as well?
Yep!
>> Source/WebCore/platform/graphics/mac/FontMac.mm:548 >> + return firstFamily().startsWith('.'); > > does this actually make sense on any platform? were there dot-prefixed fonts in 10.8?
Conveniently, the only platforms with the dot prefix are also platforms which have the CTFontDescriptorIsSystemUIFont() call :) Done.
Myles C. Maxfield
Comment 5
2014-04-22 21:09:44 PDT
Created
attachment 229951
[details]
Patch
Myles C. Maxfield
Comment 6
2014-04-23 10:50:51 PDT
First patch r+'ed by dino. Second patch simply addresses comments.
http://trac.webkit.org/changeset/167713
WebKit Commit Bot
Comment 7
2014-04-23 11:28:57 PDT
Re-opened since this is blocked by
bug 132070
Myles C. Maxfield
Comment 8
2014-04-23 14:25:45 PDT
Created
attachment 230010
[details]
Patch
Myles C. Maxfield
Comment 9
2014-04-23 14:34:13 PDT
Re-landed in
http://trac.webkit.org/changeset/167724
Darin Adler
Comment 10
2014-04-23 20:32:28 PDT
Comment on
attachment 230010
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=230010&action=review
I think you already landed this, but it was still marked review?
> Source/WebCore/platform/graphics/mac/FontMac.mm:546 > + RetainPtr<CTFontDescriptorRef> descriptor = CTFontCopyFontDescriptor(primaryFont()->platformData().ctFont());
This needs an adoptCF, otherwise it will be a storage leak.
Myles C. Maxfield
Comment 11
2014-04-23 20:51:38 PDT
Yeah - I marked the bug as closed but forgot to clear the r?. Thanks for the review.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug