Title: [185219] trunk/Source/WebCore
Revision
185219
Author
mmaxfi...@apple.com
Date
2015-06-04 15:00:09 -0700 (Thu, 04 Jun 2015)

Log Message

[Cocoa] Add ASSERT to FontPlatformData::ctFont()
https://bugs.webkit.org/show_bug.cgi?id=145659

Reviewed by Dean Jackson.

The new ASSERT needs to be guarded with CORETEXT_WEB_FONTS, which is defined in FontCustomPlatformData.h,
and is not accessible to FontPlatformData. Therefore, I've moved the definition into TextFlags.h, which
both files include.

No new tests because there is no behavior change.

* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::ctFont): Add the ASSERT.
* platform/graphics/mac/FontCustomPlatformData.h: Move the CORETEXT_WEB_FONTS preprocessor
macro from here ...
* platform/text/TextFlags.h: ... to here.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (185218 => 185219)


--- trunk/Source/WebCore/ChangeLog	2015-06-04 21:12:34 UTC (rev 185218)
+++ trunk/Source/WebCore/ChangeLog	2015-06-04 22:00:09 UTC (rev 185219)
@@ -1,3 +1,22 @@
+2015-06-04  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Add ASSERT to FontPlatformData::ctFont()
+        https://bugs.webkit.org/show_bug.cgi?id=145659
+
+        Reviewed by Dean Jackson.
+
+        The new ASSERT needs to be guarded with CORETEXT_WEB_FONTS, which is defined in FontCustomPlatformData.h,
+        and is not accessible to FontPlatformData. Therefore, I've moved the definition into TextFlags.h, which
+        both files include.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+        (WebCore::FontPlatformData::ctFont): Add the ASSERT.
+        * platform/graphics/mac/FontCustomPlatformData.h: Move the CORETEXT_WEB_FONTS preprocessor
+        macro from here ...
+        * platform/text/TextFlags.h: ... to here.
+
 2015-06-04  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r185208.

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (185218 => 185219)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2015-06-04 21:12:34 UTC (rev 185218)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2015-06-04 22:00:09 UTC (rev 185219)
@@ -176,8 +176,12 @@
         RetainPtr<CFStringRef> postScriptName = adoptCF(CTFontCopyPostScriptName(m_ctFont.get()));
         fontDescriptor = cascadeToLastResortFontDescriptor();
         m_ctFont = adoptCF(CTFontCreateCopyWithAttributes(m_ctFont.get(), ctFontSize(), 0, fontDescriptor));
-    } else
+    } else {
+#if CORETEXT_WEB_FONTS
+        ASSERT_NOT_REACHED();
+#endif
         m_ctFont = adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), ctFontSize(), 0, cascadeToLastResortFontDescriptor()));
+    }
 
     if (m_widthVariant != RegularWidth) {
         int featureTypeValue = kTextSpacingType;

Modified: trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h (185218 => 185219)


--- trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h	2015-06-04 21:12:34 UTC (rev 185218)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h	2015-06-04 22:00:09 UTC (rev 185219)
@@ -30,13 +30,6 @@
 typedef struct CGFont* CGFontRef;
 typedef const struct __CTFontDescriptor* CTFontDescriptorRef;
 
-// <rdar://problem/16980736> Web fonts crash on certain OSes when using CTFontManagerCreateFontDescriptorFromData()
-#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 80000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101000)
-#define CORETEXT_WEB_FONTS 0
-#else
-#define CORETEXT_WEB_FONTS 1
-#endif
-
 namespace WebCore {
 
 class FontPlatformData;

Modified: trunk/Source/WebCore/platform/text/TextFlags.h (185218 => 185219)


--- trunk/Source/WebCore/platform/text/TextFlags.h	2015-06-04 21:12:34 UTC (rev 185218)
+++ trunk/Source/WebCore/platform/text/TextFlags.h	2015-06-04 22:00:09 UTC (rev 185219)
@@ -26,6 +26,13 @@
 #ifndef TextFlags_h
 #define TextFlags_h
 
+// <rdar://problem/16980736>: Web fonts crash on certain OSes when using CTFontManagerCreateFontDescriptorFromData()
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 80000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101000)
+#define CORETEXT_WEB_FONTS 0
+#else
+#define CORETEXT_WEB_FONTS 1
+#endif
+
 namespace WebCore {
 
 enum TextRenderingMode { AutoTextRendering, OptimizeSpeed, OptimizeLegibility, GeometricPrecision };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to