Diff
Modified: trunk/LayoutTests/ChangeLog (288542 => 288543)
--- trunk/LayoutTests/ChangeLog 2022-01-25 07:00:01 UTC (rev 288542)
+++ trunk/LayoutTests/ChangeLog 2022-01-25 07:13:34 UTC (rev 288543)
@@ -1,3 +1,14 @@
+2022-01-24 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ REGRESSION(r282320): [Cocoa] User-installed fonts don't work in the GPU Process (in WKWebView)
+ https://bugs.webkit.org/show_bug.cgi?id=235449
+ <rdar://problem/84958961>
+
+ Reviewed by Darin Adler.
+
+ * fast/text/user-installed-canvas-expected.html: Added.
+ * fast/text/user-installed-canvas.html: Added.
+
2022-01-24 Yusuke Suzuki <ysuz...@apple.com>
[JSC] Enable Array#groupBy and Array#groupByToMap
Added: trunk/LayoutTests/fast/text/user-installed-canvas-expected.html (0 => 288543)
--- trunk/LayoutTests/fast/text/user-installed-canvas-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/user-installed-canvas-expected.html 2022-01-25 07:13:34 UTC (rev 288543)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>This test makes sure that user-installed fonts work correctly when drawn into canvas. The test passes if you see a big solid black square below (and not an @ sign).</p>
+<canvas id="canvas" width="300" height="300"></canvas>
+<script>
+let context = canvas.getContext("2d");
+context.fillRect(0, 0, 300, 300);
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/user-installed-canvas.html (0 => 288543)
--- trunk/LayoutTests/fast/text/user-installed-canvas.html (rev 0)
+++ trunk/LayoutTests/fast/text/user-installed-canvas.html 2022-01-25 07:13:34 UTC (rev 288543)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>This test makes sure that user-installed fonts work correctly when drawn into canvas. The test passes if you see a big solid black square below (and not an @ sign).</p>
+<canvas id="canvas" width="300" height="300"></canvas>
+<script>
+let context = canvas.getContext("2d");
+context.font = "400px 'Ahem'";
+context.fillText("A", -50, 270);
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/PAL/ChangeLog (288542 => 288543)
--- trunk/Source/WebCore/PAL/ChangeLog 2022-01-25 07:00:01 UTC (rev 288542)
+++ trunk/Source/WebCore/PAL/ChangeLog 2022-01-25 07:13:34 UTC (rev 288543)
@@ -1,3 +1,13 @@
+2022-01-24 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ REGRESSION(r282320): [Cocoa] User-installed fonts don't work in the GPU Process (in WKWebView)
+ https://bugs.webkit.org/show_bug.cgi?id=235449
+ <rdar://problem/84958961>
+
+ Reviewed by Darin Adler.
+
+ * pal/spi/cf/CoreTextSPI.h:
+
2022-01-24 David Quesada <david_ques...@apple.com>
Simplify accesses to SystemVersion.plist
Modified: trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h (288542 => 288543)
--- trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h 2022-01-25 07:00:01 UTC (rev 288542)
+++ trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h 2022-01-25 07:13:34 UTC (rev 288543)
@@ -95,6 +95,10 @@
typedef const struct __OTSVGTable * OTSVGTableRef;
+typedef CF_OPTIONS(uint32_t, CTFontDescriptorOptions) {
+ kCTFontDescriptorOptionThisIsNotARealOption = 0xFFFFFFFF
+};
+
#endif
WTF_EXTERN_C_BEGIN
@@ -222,4 +226,6 @@
CTFontRef CTFontCreateForCharacters(CTFontRef currentFont, const UTF16Char *characters, CFIndex length, CFIndex *coveredLength);
CGFloat CTFontGetSbixImageSizeForGlyphAndContentsScale(CTFontRef, const CGGlyph, CGFloat contentsScale);
+CTFontDescriptorOptions CTFontDescriptorGetOptions(CTFontDescriptorRef);
+
WTF_EXTERN_C_END
Modified: trunk/Source/WebKit/ChangeLog (288542 => 288543)
--- trunk/Source/WebKit/ChangeLog 2022-01-25 07:00:01 UTC (rev 288542)
+++ trunk/Source/WebKit/ChangeLog 2022-01-25 07:13:34 UTC (rev 288543)
@@ -1,3 +1,24 @@
+2022-01-24 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ REGRESSION(r282320): [Cocoa] User-installed fonts don't work in the GPU Process (in WKWebView)
+ https://bugs.webkit.org/show_bug.cgi?id=235449
+ <rdar://problem/84958961>
+
+ Reviewed by Darin Adler.
+
+ The reason for this bug was I was misusing kCTFontOptionsSystemUIFont. I thought this flag just
+ meant "allow the creation of system fonts" but it turns out it means something more subtle than
+ that. Instead of unconditionally specifying this flag, we should just pull out the options field
+ from the source font (which will include that flag if the font was a system font) and use that
+ instead.
+
+ Test: fast/text/user-installed-canvas.html
+
+ * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+ (IPC::ArgumentCoder<Ref<WebCore::Font>>::encodePlatformData):
+ (IPC::createCTFont):
+ (IPC::ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData):
+
2022-01-24 Mark Lam <mark....@apple.com>
Rename Vector and FixedVector::findMatching to findIf to match stl naming.
Modified: trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (288542 => 288543)
--- trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2022-01-25 07:00:01 UTC (rev 288542)
+++ trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2022-01-25 07:13:34 UTC (rev 288543)
@@ -461,16 +461,18 @@
encoder << creationData->fontFaceData;
encoder << creationData->itemInCollection;
} else {
+ auto options = CTFontDescriptorGetOptions(fontDescriptor.get());
+ encoder << options;
auto referenceURL = adoptCF(static_cast<CFURLRef>(CTFontCopyAttribute(ctFont, kCTFontReferenceURLAttribute)));
auto string = CFURLGetString(referenceURL.get());
- encoder << String(string);
- encoder << String(adoptCF(CTFontCopyPostScriptName(ctFont)).get());
+ encoder << string;
+ encoder << adoptCF(CTFontCopyPostScriptName(ctFont)).get();
}
}
-static RetainPtr<CTFontDescriptorRef> findFontDescriptor(const String& referenceURL, const String& postScriptName)
+static RetainPtr<CTFontDescriptorRef> findFontDescriptor(CFStringRef referenceURL, CFStringRef postScriptName)
{
- auto url = "" referenceURL.createCFString().get(), nullptr));
+ auto url = "" referenceURL, nullptr));
if (!url)
return nullptr;
auto fontDescriptors = adoptCF(CTFontManagerCreateFontDescriptorsFromURL(url.get()));
@@ -481,20 +483,20 @@
for (CFIndex i = 0; i < CFArrayGetCount(fontDescriptors.get()); ++i) {
auto fontDescriptor = static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(fontDescriptors.get(), i));
- auto currentPostScriptName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontNameAttribute)));
- if (String(currentPostScriptName.get()) == postScriptName)
+ auto currentPostScriptName = adoptCF(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontNameAttribute));
+ if (CFEqual(currentPostScriptName.get(), postScriptName))
return fontDescriptor;
}
return nullptr;
}
-static RetainPtr<CTFontRef> createCTFont(CFDictionaryRef attributes, float size, const String& referenceURL, const String& desiredPostScriptName)
+static RetainPtr<CTFontRef> createCTFont(CFDictionaryRef attributes, float size, CTFontDescriptorOptions options, CFStringRef referenceURL, CFStringRef desiredPostScriptName)
{
auto fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes));
if (fontDescriptor) {
- auto font = adoptCF(CTFontCreateWithFontDescriptorAndOptions(fontDescriptor.get(), size, nullptr, kCTFontOptionsSystemUIFont));
- String actualPostScriptName(adoptCF(CTFontCopyPostScriptName(font.get())).get());
- if (actualPostScriptName == desiredPostScriptName)
+ auto font = adoptCF(CTFontCreateWithFontDescriptorAndOptions(fontDescriptor.get(), size, nullptr, options));
+ auto actualPostScriptName = adoptCF(CTFontCopyPostScriptName(font.get()));
+ if (CFEqual(actualPostScriptName.get(), desiredPostScriptName))
return font;
}
@@ -506,7 +508,7 @@
fontDescriptor = adoptCF(CTFontDescriptorCreateLastResort());
}
ASSERT(fontDescriptor);
- return adoptCF(CTFontCreateWithFontDescriptorAndOptions(fontDescriptor.get(), size, nullptr, kCTFontOptionsSystemUIFont));
+ return adoptCF(CTFontCreateWithFontDescriptorAndOptions(fontDescriptor.get(), size, nullptr, options));
}
std::optional<WebCore::FontPlatformData> ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData(Decoder& decoder)
@@ -577,17 +579,22 @@
return WebCore::FontPlatformData(ctFont.get(), *size, *syntheticBold, *syntheticOblique, *orientation, *widthVariant, *textRenderingMode, &creationData);
}
- std::optional<String> referenceURL;
+ std::optional<CTFontDescriptorOptions> options;
+ decoder >> options;
+ if (!options)
+ return std::nullopt;
+
+ std::optional<RetainPtr<CFStringRef>> referenceURL;
decoder >> referenceURL;
- if (!referenceURL)
+ if (!referenceURL || !*referenceURL)
return std::nullopt;
- std::optional<String> postScriptName;
+ std::optional<RetainPtr<CFStringRef>> postScriptName;
decoder >> postScriptName;
- if (!postScriptName)
+ if (!postScriptName || !*postScriptName)
return std::nullopt;
- auto ctFont = createCTFont(attributes->get(), *size, *referenceURL, *postScriptName);
+ auto ctFont = createCTFont(attributes->get(), *size, *options, referenceURL->get(), postScriptName->get());
if (!ctFont)
return std::nullopt;