summaryrefslogtreecommitdiffstats
path: root/base/mac
diff options
context:
space:
mode:
Diffstat (limited to 'base/mac')
-rw-r--r--base/mac/foundation_util.h10
-rw-r--r--base/mac/foundation_util.mm60
2 files changed, 1 insertions, 69 deletions
diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h
index 46ea3c3..447f7bf 100644
--- a/base/mac/foundation_util.h
+++ b/base/mac/foundation_util.h
@@ -16,14 +16,10 @@
#if defined(__OBJC__)
#import <Foundation/Foundation.h>
-@class NSFont;
-@class UIFont;
#else // __OBJC__
#include <CoreFoundation/CoreFoundation.h>
class NSBundle;
-class NSFont;
class NSString;
-class UIFont;
#endif // __OBJC__
#if defined(OS_IOS)
@@ -229,12 +225,6 @@ CF_TO_NS_CAST_DECL(CFWriteStream, NSOutputStream);
CF_TO_NS_MUTABLE_CAST_DECL(String);
CF_TO_NS_CAST_DECL(CFURL, NSURL);
-#if defined(OS_IOS)
-CF_TO_NS_CAST_DECL(CTFont, UIFont);
-#else
-CF_TO_NS_CAST_DECL(CTFont, NSFont);
-#endif
-
#undef CF_TO_NS_CAST_DECL
#undef CF_TO_NS_MUTABLE_CAST_DECL
#undef OBJC_CPP_CLASS_DECL
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 4e9b224..19df847 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -17,7 +17,6 @@
extern "C" {
CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID();
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
} // extern "C"
#endif
@@ -291,31 +290,6 @@ CF_TO_NS_CAST_DEFN(CFWriteStream, NSOutputStream);
CF_TO_NS_MUTABLE_CAST_DEFN(String);
CF_TO_NS_CAST_DEFN(CFURL, NSURL);
-#if defined(OS_IOS)
-CF_TO_NS_CAST_DEFN(CTFont, UIFont);
-#else
-// The NSFont/CTFont toll-free bridging is broken when it comes to type
-// checking, so do some special-casing.
-// http://www.openradar.me/15341349 rdar://15341349
-NSFont* CFToNSCast(CTFontRef cf_val) {
- NSFont* ns_val =
- const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
- DCHECK(!cf_val ||
- CTFontGetTypeID() == CFGetTypeID(cf_val) ||
- (_CFIsObjC(CTFontGetTypeID(), cf_val) &&
- [ns_val isKindOfClass:NSClassFromString(@"NSFont")]));
- return ns_val;
-}
-
-CTFontRef NSToCFCast(NSFont* ns_val) {
- CTFontRef cf_val = reinterpret_cast<CTFontRef>(ns_val);
- DCHECK(!cf_val ||
- CTFontGetTypeID() == CFGetTypeID(cf_val) ||
- [ns_val isKindOfClass:NSClassFromString(@"NSFont")]);
- return cf_val;
-}
-#endif
-
#undef CF_TO_NS_CAST_DEFN
#undef CF_TO_NS_MUTABLE_CAST_DEFN
@@ -353,40 +327,8 @@ CF_CAST_DEFN(CFUUID);
CF_CAST_DEFN(CGColor);
-CF_CAST_DEFN(CTRun);
-
-#if defined(OS_IOS)
CF_CAST_DEFN(CTFont);
-#else
-// The NSFont/CTFont toll-free bridging is broken when it comes to type
-// checking, so do some special-casing.
-// http://www.openradar.me/15341349 rdar://15341349
-template<> CTFontRef
-CFCast<CTFontRef>(const CFTypeRef& cf_val) {
- if (cf_val == NULL) {
- return NULL;
- }
- if (CFGetTypeID(cf_val) == CTFontGetTypeID()) {
- return (CTFontRef)(cf_val);
- }
-
- if (!_CFIsObjC(CTFontGetTypeID(), cf_val))
- return NULL;
-
- id<NSObject> ns_val = reinterpret_cast<id>(const_cast<void*>(cf_val));
- if ([ns_val isKindOfClass:NSClassFromString(@"NSFont")]) {
- return (CTFontRef)(cf_val);
- }
- return NULL;
-}
-
-template<> CTFontRef
-CFCastStrict<CTFontRef>(const CFTypeRef& cf_val) {
- CTFontRef rv = CFCast<CTFontRef>(cf_val);
- DCHECK(cf_val == NULL || rv);
- return rv;
-}
-#endif
+CF_CAST_DEFN(CTRun);
#if !defined(OS_IOS)
CF_CAST_DEFN(SecACL);