Title: [93781] trunk/Source/WebCore
Revision
93781
Author
podivi...@chromium.org
Date
2011-08-25 06:08:05 -0700 (Thu, 25 Aug 2011)

Log Message

Unreviewed, rolling out r93771.
http://trac.webkit.org/changeset/93771
https://bugs.webkit.org/show_bug.cgi?id=66933

Broke css3/font-feature-settings-rendering.html on chromium
mac 10.5 (Requested by podivilov on #webkit).

Patch by Sheriff Bot <webkit.review....@gmail.com> on 2011-08-25

* 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 (93780 => 93781)


--- trunk/Source/WebCore/ChangeLog	2011-08-25 12:52:15 UTC (rev 93780)
+++ trunk/Source/WebCore/ChangeLog	2011-08-25 13:08:05 UTC (rev 93781)
@@ -1,3 +1,18 @@
+2011-08-25  Sheriff Bot  <webkit.review....@gmail.com>
+
+        Unreviewed, rolling out r93771.
+        http://trac.webkit.org/changeset/93771
+        https://bugs.webkit.org/show_bug.cgi?id=66933
+
+        Broke css3/font-feature-settings-rendering.html on chromium
+        mac 10.5 (Requested by podivilov on #webkit).
+
+        * platform/graphics/mac/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::~FontCustomPlatformData):
+        (WebCore::createFontCustomPlatformData):
+        * platform/graphics/mac/FontCustomPlatformData.h:
+        (WebCore::FontCustomPlatformData::FontCustomPlatformData):
+
 2011-08-23  Jocelyn Turcotte  <jocelyn.turco...@nokia.com>
 
         [Qt][WK2] Drive tiling from the WebProcess and reuse TiledBackingStore.

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


--- trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp	2011-08-25 12:52:15 UTC (rev 93780)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp	2011-08-25 13:08:05 UTC (rev 93781)
@@ -78,6 +78,10 @@
 
 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
@@ -111,16 +115,51 @@
     }
 #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.
 
-    FontCustomPlatformData* fontCustomPlatformData = new FontCustomPlatformData(cgFontRef.releaseRef());
+    // 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());
 #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 (93780 => 93781)


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

Reply via email to