Diff
Modified: trunk/LayoutTests/ChangeLog (216274 => 216275)
--- trunk/LayoutTests/ChangeLog 2017-05-05 21:36:58 UTC (rev 216274)
+++ trunk/LayoutTests/ChangeLog 2017-05-05 21:54:59 UTC (rev 216275)
@@ -1,3 +1,14 @@
+2017-05-05 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Cocoa] CTFontDescriptorCreateMatchingFontDescriptor() is not case insensitive
+ https://bugs.webkit.org/show_bug.cgi?id=171636
+ <rdar://problem/30811218>
+
+ Reviewed by Dean Jackson.
+
+ * fast/text/lastResort-expected.html: Added.
+ * fast/text/lastResort.html: Added.
+
2017-05-05 Ryan Haddad <ryanhad...@apple.com>
Unskip media/click-placeholder-not-pausing.html.
Added: trunk/LayoutTests/fast/text/lastResort-expected.html (0 => 216275)
--- trunk/LayoutTests/fast/text/lastResort-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/lastResort-expected.html 2017-05-05 21:54:59 UTC (rev 216275)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that Last Resort is always looked up correctly.
+<div style="font-family: LastResort;">hi</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/lastResort.html (0 => 216275)
--- trunk/LayoutTests/fast/text/lastResort.html (rev 0)
+++ trunk/LayoutTests/fast/text/lastResort.html 2017-05-05 21:54:59 UTC (rev 216275)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that Last Resort is always looked up correctly.
+<div style="font-family: lastresort;">hi</div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (216274 => 216275)
--- trunk/Source/WebCore/ChangeLog 2017-05-05 21:36:58 UTC (rev 216274)
+++ trunk/Source/WebCore/ChangeLog 2017-05-05 21:54:59 UTC (rev 216275)
@@ -1,3 +1,23 @@
+2017-05-05 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Cocoa] CTFontDescriptorCreateMatchingFontDescriptor() is not case insensitive
+ https://bugs.webkit.org/show_bug.cgi?id=171636
+ <rdar://problem/30811218>
+
+ Reviewed by Dean Jackson.
+
+ LastResort is the only name which needs to be looked up case-sensitively. We can handle
+ this in our existing function which handles special font names (like -apple-system) to
+ make sure that we always do the right thing.
+
+ Test: fast/text/lastResort.html
+
+ * platform/spi/cocoa/CoreTextSPI.h:
+ * platform/graphics/ios/FontCacheIOS.mm:
+ (WebCore::platformFontWithFamilySpecialCase):
+ * platform/graphics/mac/FontCacheMac.mm:
+ (WebCore::platformFontWithFamilySpecialCase):
+
2017-05-05 Said Abou-Hallawa <sabouhall...@apple.com>
Crash in ImageFrameCache::decodedSizeChanged() after image load cancellation
Modified: trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (216274 => 216275)
--- trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm 2017-05-05 21:36:58 UTC (rev 216274)
+++ trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm 2017-05-05 21:54:59 UTC (rev 216275)
@@ -164,6 +164,17 @@
return adoptCF(CTFontCreateWithFontDescriptor(monospaceFontDescriptor.get(), size, nullptr));
}
+ if (equalLettersIgnoringASCIICase(family, "lastresort")) {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+ static NeverDestroyed<RetainPtr<CTFontDescriptorRef>> lastResort = adoptCF(CTFontDescriptorCreateLastResort());
+ return adoptCF(CTFontCreateWithFontDescriptor(lastResort.get().get(), size, nullptr));
+#else
+ // LastResort is special, so it's important to look this exact string up, and not some case-folded version.
+ // We handle this here so any caching and case folding we do in our general text codepath is bypassed.
+ return adoptCF(CTFontCreateWithName(CFSTR("LastResort"), size, nullptr));
+#endif
+ }
+
return nullptr;
}
Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (216274 => 216275)
--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2017-05-05 21:36:58 UTC (rev 216274)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2017-05-05 21:54:59 UTC (rev 216275)
@@ -111,6 +111,17 @@
if (equalLettersIgnoringASCIICase(family, "-apple-status-bar"))
return toCTFont([NSFont labelFontOfSize:size]);
+ if (equalLettersIgnoringASCIICase(family, "lastresort")) {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+ static NeverDestroyed<RetainPtr<CTFontDescriptorRef>> lastResort = adoptCF(CTFontDescriptorCreateLastResort());
+ return adoptCF(CTFontCreateWithFontDescriptor(lastResort.get().get(), size, nullptr));
+#else
+ // LastResort is special, so it's important to look this exact string up, and not some case-folded version.
+ // We handle this here so any caching and case folding we do in our general text codepath is bypassed.
+ return adoptCF(CTFontCreateWithName(CFSTR("LastResort"), size, nullptr));
+#endif
+ }
+
return nullptr;
}
Modified: trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h (216274 => 216275)
--- trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h 2017-05-05 21:36:58 UTC (rev 216274)
+++ trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h 2017-05-05 21:54:59 UTC (rev 216275)
@@ -83,6 +83,7 @@
CFBitVectorRef CTFontCopyGlyphCoverageForFeature(CTFontRef, CFDictionaryRef feature);
CTFontDescriptorRef CTFontDescriptorCreateWithAttributesAndOptions(CFDictionaryRef attributes, CTFontDescriptorOptions);
+CTFontDescriptorRef CTFontDescriptorCreateLastResort();
extern const CFStringRef kCTFontCSSWeightAttribute;
extern const CFStringRef kCTFontCSSWidthAttribute;