Title: [93771] trunk/Source/WebCore
Revision
93771
Author
[email protected]
Date
2011-08-25 03:18:55 -0700 (Thu, 25 Aug 2011)

Log Message

Remove ATSFont*() functions in favor of CGFont in FontCustomPlatformData.cpp
https://bugs.webkit.org/show_bug.cgi?id=66629

As of r72774 and dropping support for OS X 10.4, we can safely
remove the ATS APIs from FontCustomPlatformData.cpp in favor of just the
CGFont code.

This change is motivated by a bug in ATSFontDeactivite() on 10.7 which
affects the Chromium port, due to its compiling once against the 10.5
SDK for all platforms - See crbug.com/93191 or rdar://9976774 .

Reviewed by Dan Bernstein.

No new tests - covered by existing tests.

* platform/graphics/mac/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::~FontCustomPlatformData):
(WebCore::createFontCustomPlatformData):
* platform/graphics/mac/FontCustomPlatformData.h:
(WebCore::FontCustomPlatformData::FontCustomPlatformData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93770 => 93771)


--- trunk/Source/WebCore/ChangeLog	2011-08-25 10:05:13 UTC (rev 93770)
+++ trunk/Source/WebCore/ChangeLog	2011-08-25 10:18:55 UTC (rev 93771)
@@ -1,3 +1,26 @@
+2011-08-25  Jeremy Moskovich  <[email protected]>
+
+        Remove ATSFont*() functions in favor of CGFont in FontCustomPlatformData.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=66629
+
+        As of r72774 and dropping support for OS X 10.4, we can safely
+        remove the ATS APIs from FontCustomPlatformData.cpp in favor of just the
+        CGFont code.
+
+        This change is motivated by a bug in ATSFontDeactivite() on 10.7 which
+        affects the Chromium port, due to its compiling once against the 10.5
+        SDK for all platforms - See crbug.com/93191 or rdar://9976774 .
+
+        Reviewed by Dan Bernstein.
+
+        No new tests - covered by existing tests.
+
+        * platform/graphics/mac/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::~FontCustomPlatformData):
+        (WebCore::createFontCustomPlatformData):
+        * platform/graphics/mac/FontCustomPlatformData.h:
+        (WebCore::FontCustomPlatformData::FontCustomPlatformData):
+
 2011-08-25  Pavel Feldman  <[email protected]>
 
         Not reviewed: rollout r93768 for breaking build.

Modified: trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp (93770 => 93771)


--- trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp	2011-08-25 10:05:13 UTC (rev 93770)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp	2011-08-25 10:18:55 UTC (rev 93771)
@@ -78,10 +78,6 @@
 
 FontCustomPlatformData::~FontCustomPlatformData()
 {
-#ifdef BUILDING_ON_LEOPARD
-    if (m_atsContainer)
-        ATSFontDeactivate(m_atsContainer, NULL, kATSOptionFlagsDefault);
-#endif
 #if USE(SKIA_ON_MAC_CHROMIUM)
     SkSafeUnref(m_typeface);
 #endif
@@ -115,51 +111,16 @@
     }
 #endif
 
-    ATSFontContainerRef containerRef = 0;
-
     RetainPtr<CGFontRef> cgFontRef;
 
-#ifndef BUILDING_ON_LEOPARD
     RetainPtr<CFDataRef> bufferData(AdoptCF, buffer->createCFData());
     RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get()));
 
     cgFontRef.adoptCF(CGFontCreateWithDataProvider(dataProvider.get()));
     if (!cgFontRef)
         return 0;
-#else
-    // Use ATS to activate the font.
 
-    // The value "3" means that the font is private and can't be seen by anyone else.
-    ATSFontActivateFromMemory((void*)buffer->data(), buffer->size(), 3, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, &containerRef);
-    if (!containerRef)
-        return 0;
-    ItemCount fontCount;
-    ATSFontFindFromContainer(containerRef, kATSOptionFlagsDefault, 0, NULL, &fontCount);
-    
-    // We just support the first font in the list.
-    if (fontCount == 0) {
-        ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault);
-        return 0;
-    }
-    
-    ATSFontRef fontRef = 0;
-    ATSFontFindFromContainer(containerRef, kATSOptionFlagsDefault, 1, &fontRef, NULL);
-    if (!fontRef) {
-        ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault);
-        return 0;
-    }
-    
-    cgFontRef.adoptCF(CGFontCreateWithPlatformFont(&fontRef));
-    // Workaround for <rdar://problem/5675504>.
-    if (cgFontRef && !CGFontGetNumberOfGlyphs(cgFontRef.get()))
-        cgFontRef = 0;
-    if (!cgFontRef) {
-        ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault);
-        return 0;
-    }
-#endif // !defined(BUILDING_ON_LEOPARD)
-
-    FontCustomPlatformData* fontCustomPlatformData = new FontCustomPlatformData(containerRef, cgFontRef.releaseRef());
+    FontCustomPlatformData* fontCustomPlatformData = new FontCustomPlatformData(cgFontRef.releaseRef());
 #if USE(SKIA_ON_MAC_CHROMIUM)
     RemoteFontStream* stream = new RemoteFontStream(buffer);
     fontCustomPlatformData->m_typeface = SkTypeface::CreateFromStream(stream);

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


--- trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h	2011-08-25 10:05:13 UTC (rev 93770)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h	2011-08-25 10:18:55 UTC (rev 93771)
@@ -45,9 +45,8 @@
 struct FontCustomPlatformData {
     WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
 public:
-    FontCustomPlatformData(ATSFontContainerRef container, CGFontRef cgFont)
-        : m_atsContainer(container)
-        , m_cgFont(cgFont)
+    explicit FontCustomPlatformData(CGFontRef cgFont)
+        : m_cgFont(cgFont)
 #if USE(SKIA_ON_MAC_CHROMIUM)
         , m_typeface(0)
 #endif
@@ -60,7 +59,6 @@
 
     static bool supportsFormat(const String&);
 
-    ATSFontContainerRef m_atsContainer;
     CGFontRef m_cgFont;
 #if USE(SKIA_ON_MAC_CHROMIUM)
     SkTypeface* m_typeface;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to