Title: [91237] trunk/Source/WebCore
Revision
91237
Author
[email protected]
Date
2011-07-18 21:14:42 -0700 (Mon, 18 Jul 2011)

Log Message

REGRESSION(91209?): fast/css/custom-font-xheight.html is failing on Leopard
https://bugs.webkit.org/show_bug.cgi?id=64767

Add a runtime check for font cascading optimization.

It's a constant value in Mac port so hopefully gcc will constant-propagate the value
and eliminate the function altogether.

* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::canSetCascadeListForCustomFont): Added.
(WebCore::FontPlatformData::ctFont):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (91236 => 91237)


--- trunk/Source/WebCore/ChangeLog	2011-07-19 04:03:58 UTC (rev 91236)
+++ trunk/Source/WebCore/ChangeLog	2011-07-19 04:14:42 UTC (rev 91237)
@@ -1,3 +1,17 @@
+2011-07-18  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(91209?): fast/css/custom-font-xheight.html is failing on Leopard
+        https://bugs.webkit.org/show_bug.cgi?id=64767
+
+        Add a runtime check for font cascading optimization.
+
+        It's a constant value in Mac port so hopefully gcc will constant-propagate the value
+        and eliminate the function altogether.
+
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+        (WebCore::canSetCascadeListForCustomFont): Added.
+        (WebCore::FontPlatformData::ctFont):
+
 2011-07-18  MORITA Hajime  <[email protected]>
 
         [ShadowContentElement] forwarded node should be able to access its hosting content element.

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


--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2011-07-19 04:03:58 UTC (rev 91236)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2011-07-19 04:14:42 UTC (rev 91237)
@@ -192,6 +192,24 @@
     return descriptor;
 }
 
+// Adding a cascade list breaks the font on Leopard
+static bool canSetCascadeListForCustomFont()
+{
+#if PLATFORM(CHROMIUM)
+    static SInt32 systemVersion;
+    if (!systemVersion) {
+        if (Gestalt(gestaltSystemVersion, &systemVersion) != noErr)
+            return false;
+    }
+
+    return systemVersion >= 0x1060;
+#elif !defined(BUILDING_ON_LEOPARD)
+    return true;
+#else
+    return false;
+#endif
+}
+
 CTFontRef FontPlatformData::ctFont() const
 {
     if (m_CTFont)
@@ -200,13 +218,8 @@
     m_CTFont = toCTFontRef(m_font);
     if (m_CTFont)
         m_CTFont.adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_size, 0, cascadeToLastResortFontDescriptor()));
-    else {
-#if !defined(BUILDING_ON_LEOPARD)
-        m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, cascadeToLastResortFontDescriptor()));
-#else
-        m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, 0));
-#endif
-    }
+    else
+        m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, canSetCascadeListForCustomFont() ? cascadeToLastResortFontDescriptor() : 0));
 
     if (m_widthVariant != RegularWidth) {
         int featureTypeValue = kTextSpacingType;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to