Remove CORETEXT_WEB_FONTS
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Dec 2015 07:55:41 +0000 (07:55 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Dec 2015 07:55:41 +0000 (07:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151891

Reviewed by Simon Fraser.

The only platform where this was turned off (Mavericks) is no longer supported.

No new tests because there is no behavior difference.

* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::platformCreateScaledFont): Deleted.
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::registeredFont):
(WebCore::FontPlatformData::ctFont):
* platform/graphics/mac/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData): Deleted.
(WebCore::createFontCustomPlatformData): Deleted.
* platform/graphics/mac/FontCustomPlatformData.h:
(WebCore::FontCustomPlatformData::FontCustomPlatformData): Deleted.
* platform/text/TextFlags.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193512 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cocoa/FontCocoa.mm
Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h
Source/WebCore/platform/text/TextFlags.h

index d113d42..2313331 100644 (file)
@@ -1,3 +1,26 @@
+2015-12-04  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Remove CORETEXT_WEB_FONTS
+        https://bugs.webkit.org/show_bug.cgi?id=151891
+
+        Reviewed by Simon Fraser.
+
+        The only platform where this was turned off (Mavericks) is no longer supported.
+
+        No new tests because there is no behavior difference.
+
+        * platform/graphics/cocoa/FontCocoa.mm:
+        (WebCore::Font::platformCreateScaledFont): Deleted.
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+        (WebCore::FontPlatformData::registeredFont):
+        (WebCore::FontPlatformData::ctFont):
+        * platform/graphics/mac/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::fontPlatformData): Deleted.
+        (WebCore::createFontCustomPlatformData): Deleted.
+        * platform/graphics/mac/FontCustomPlatformData.h:
+        (WebCore::FontCustomPlatformData::FontCustomPlatformData): Deleted.
+        * platform/text/TextFlags.h:
+
 2015-12-04  Zalan Bujtas  <zalan@apple.com>
 
         Garbage in page tiles when document is too long.
index c78a6ff..9b0d6b3 100644 (file)
@@ -283,14 +283,6 @@ void Font::platformDestroy()
 
 RefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float scaleFactor) const
 {
-#if !CORETEXT_WEB_FONTS
-    if (isCustomFont()) {
-        FontPlatformData scaledFontData(m_platformData);
-        scaledFontData.m_size = scaledFontData.m_size * scaleFactor;
-        return Font::create(scaledFontData, true, false);
-    }
-#endif
-
     float size = m_platformData.size() * scaleFactor;
 
 #if USE(APPKIT)
index 2130ef4..2d4bf39 100644 (file)
@@ -102,7 +102,7 @@ bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const
 CTFontRef FontPlatformData::registeredFont() const
 {
     CTFontRef platformFont = font();
-    ASSERT(!CORETEXT_WEB_FONTS || platformFont);
+    ASSERT(platformFont);
     if (platformFont && adoptCF(CTFontCopyAttribute(platformFont, kCTFontURLAttribute)))
         return platformFont;
     return nullptr;
@@ -175,19 +175,13 @@ CTFontRef FontPlatformData::ctFont() const
     if (m_ctFont)
         return m_ctFont.get();
 
-    ASSERT(m_cgFont.get());
+    ASSERT(m_font);
+    ASSERT(m_cgFont);
     m_ctFont = m_font;
-    if (m_ctFont) {
-        CTFontDescriptorRef fontDescriptor;
-        RetainPtr<CFStringRef> postScriptName = adoptCF(CTFontCopyPostScriptName(m_ctFont.get()));
-        fontDescriptor = cascadeToLastResortFontDescriptor();
-        m_ctFont = adoptCF(CTFontCreateCopyWithAttributes(m_ctFont.get(), m_size, 0, fontDescriptor));
-    } else {
-#if CORETEXT_WEB_FONTS
-        ASSERT_NOT_REACHED();
-#endif
-        m_ctFont = adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, cascadeToLastResortFontDescriptor()));
-    }
+    CTFontDescriptorRef fontDescriptor;
+    RetainPtr<CFStringRef> postScriptName = adoptCF(CTFontCopyPostScriptName(m_ctFont.get()));
+    fontDescriptor = cascadeToLastResortFontDescriptor();
+    m_ctFont = adoptCF(CTFontCreateCopyWithAttributes(m_ctFont.get(), m_size, 0, fontDescriptor));
 
     if (m_widthVariant != RegularWidth) {
         int featureTypeValue = kTextSpacingType;
index 9a7e200..6f7a8a0 100644 (file)
@@ -39,38 +39,20 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription&
     int size = fontDescription.computedPixelSize();
     FontOrientation orientation = fontDescription.orientation();
     FontWidthVariant widthVariant = fontDescription.widthVariant();
-#if CORETEXT_WEB_FONTS
     RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr));
     font = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), &fontFaceFeatures, &fontFaceVariantSettings, fontDescription.featureSettings(), fontDescription.variantSettings());
     return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode());
-#else
-    UNUSED_PARAM(fontFaceFeatures);
-    UNUSED_PARAM(fontFaceVariantSettings);
-    return FontPlatformData(m_cgFont.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode());
-#endif
 }
 
 std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer& buffer)
 {
     RetainPtr<CFDataRef> bufferData = buffer.createCFData();
 
-#if CORETEXT_WEB_FONTS
     RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontManagerCreateFontDescriptorFromData(bufferData.get()));
     if (!fontDescriptor)
         return nullptr;
 
     return std::make_unique<FontCustomPlatformData>(fontDescriptor.get());
-
-#else
-
-    RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(bufferData.get()));
-
-    RetainPtr<CGFontRef> cgFontRef = adoptCF(CGFontCreateWithDataProvider(dataProvider.get()));
-    if (!cgFontRef)
-        return nullptr;
-
-    return std::make_unique<FontCustomPlatformData>(cgFontRef.get());
-#endif
 }
 
 bool FontCustomPlatformData::supportsFormat(const String& format)
index efde9e7..de3d0ed 100644 (file)
@@ -40,13 +40,8 @@ class SharedBuffer;
 struct FontCustomPlatformData {
     WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
 public:
-#if CORETEXT_WEB_FONTS
     explicit FontCustomPlatformData(CTFontDescriptorRef fontDescriptor)
         : m_fontDescriptor(fontDescriptor)
-#else
-    explicit FontCustomPlatformData(CGFontRef cgFont)
-        : m_cgFont(cgFont)
-#endif
     {
     }
 
@@ -56,11 +51,7 @@ public:
 
     static bool supportsFormat(const String&);
 
-#if CORETEXT_WEB_FONTS
     RetainPtr<CTFontDescriptorRef> m_fontDescriptor;
-#else
-    RetainPtr<CGFontRef> m_cgFont;
-#endif
 };
 
 std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer&);
index a31cd28..0c282fe 100644 (file)
 #ifndef TextFlags_h
 #define TextFlags_h
 
-// <rdar://problem/16980736>: Web fonts crash on certain OSes when using CTFontManagerCreateFontDescriptorFromData()
-// FIXME: When we have moved entirely to CORETEXT_WEB_FONTS, remove the isCustomFont member variable from Font, since it will no longer be used.
-// See https://bug-145873-attachments.webkit.org/attachment.cgi?id=254710
-#if 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 };