Title: [281681] trunk
- Revision
- 281681
- Author
- [email protected]
- Date
- 2021-08-26 20:37:05 -0700 (Thu, 26 Aug 2021)
Log Message
[Cocoa] Enforce the policy against WebKit causing Core Text font download prompts in WebKit1
https://bugs.webkit.org/show_bug.cgi?id=229391
Reviewed by Alan Bujtas.
Source/WebCore:
For most apps, if you ask Core Text to create a font which is a mobileasset font, it will
show a synchronous blocking prompt asking the user if they want to download the font.
However, this policy isn't a great one for web content, because webpages will request tons
of fonts all the time, and it's totally likely that many of them will be mobileasset fonts.
Because of this, WebKit has a policy where we will opt out of showing these prompts, by
specifying kCTFontEnabledAttribute:kCFBooleanTrue in the attributes dictionary.
We do this in some places, but we forgot one additional place. This patch adds it to this
place, and adds a test which intentionally requests a MobileAsset font and makes sure the
test doesn't timeout (by showing a blocking prompt forever).
Test: fast/text/mobileasset-font.html
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::autoActivateFont):
LayoutTests:
Make sure content which uses these fonts doesn't cause a blocking prompt.
* fast/text/mobileasset-font-expected-mismatch.html: Added.
* fast/text/mobileasset-font.html: Added.
* platform/mac/TestExpectations: Skip the test on Catalina, because apparently the prompts can't be skipped?
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (281680 => 281681)
--- trunk/LayoutTests/ChangeLog 2021-08-27 03:08:57 UTC (rev 281680)
+++ trunk/LayoutTests/ChangeLog 2021-08-27 03:37:05 UTC (rev 281681)
@@ -1,3 +1,16 @@
+2021-08-26 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Enforce the policy against WebKit causing Core Text font download prompts in WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=229391
+
+ Reviewed by Alan Bujtas.
+
+ Make sure content which uses these fonts doesn't cause a blocking prompt.
+
+ * fast/text/mobileasset-font-expected-mismatch.html: Added.
+ * fast/text/mobileasset-font.html: Added.
+ * platform/mac/TestExpectations: Skip the test on Catalina, because apparently the prompts can't be skipped?
+
2021-08-26 Arcady Goldmints-Orlov <[email protected]>
[GLIB] Skip the webgl/pending/conformance2 tests, as WebGL2 is not yet supported
Added: trunk/LayoutTests/fast/text/mobileasset-font-expected-mismatch.html (0 => 281681)
--- trunk/LayoutTests/fast/text/mobileasset-font-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/text/mobileasset-font-expected-mismatch.html 2021-08-27 03:37:05 UTC (rev 281681)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that WebKit doesn't prompt the user to download mobileasset fonts. The test passes if you don't see a blocking prompt asking you to download the Osaka font. On a bot, this would manifest by a timeout.
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/mobileasset-font.html (0 => 281681)
--- trunk/LayoutTests/fast/text/mobileasset-font.html (rev 0)
+++ trunk/LayoutTests/fast/text/mobileasset-font.html 2021-08-27 03:37:05 UTC (rev 281681)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that WebKit doesn't prompt the user to download mobileasset fonts. The test passes if you don't see a blocking prompt asking you to download the Osaka font. On a bot, this would manifest by a timeout.
+<div style="font: 100px 'Osaka';">の</div>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac/TestExpectations (281680 => 281681)
--- trunk/LayoutTests/platform/mac/TestExpectations 2021-08-27 03:08:57 UTC (rev 281680)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2021-08-27 03:37:05 UTC (rev 281681)
@@ -2383,3 +2383,6 @@
webkit.org/b/229588 http/tests/media/user-gesture-preserved-across-xmlhttprequest.html [ Pass Crash Failure Timeout ]
webkit.org/b/228176 [ Mojave Catalina BigSur Monterey ] fast/text/variable-system-font-2.html [ Pass ]
+
+# This test opens apparently unskippable prompts on Catalina.
+webkit.org/b/229391 [ Mojave Catalina ] fast/text/mobileasset-font.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (281680 => 281681)
--- trunk/Source/WebCore/ChangeLog 2021-08-27 03:08:57 UTC (rev 281680)
+++ trunk/Source/WebCore/ChangeLog 2021-08-27 03:37:05 UTC (rev 281681)
@@ -1,3 +1,26 @@
+2021-08-26 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Enforce the policy against WebKit causing Core Text font download prompts in WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=229391
+
+ Reviewed by Alan Bujtas.
+
+ For most apps, if you ask Core Text to create a font which is a mobileasset font, it will
+ show a synchronous blocking prompt asking the user if they want to download the font.
+ However, this policy isn't a great one for web content, because webpages will request tons
+ of fonts all the time, and it's totally likely that many of them will be mobileasset fonts.
+ Because of this, WebKit has a policy where we will opt out of showing these prompts, by
+ specifying kCTFontEnabledAttribute:kCFBooleanTrue in the attributes dictionary.
+
+ We do this in some places, but we forgot one additional place. This patch adds it to this
+ place, and adds a test which intentionally requests a MobileAsset font and makes sure the
+ test doesn't timeout (by showing a blocking prompt forever).
+
+ Test: fast/text/mobileasset-font.html
+
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::autoActivateFont):
+
2021-08-26 Alan Bujtas <[email protected]>
[LFC][Integration] Use the line runs to check for legacy integral positioning
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (281680 => 281681)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2021-08-27 03:08:57 UTC (rev 281680)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2021-08-27 03:37:05 UTC (rev 281681)
@@ -1278,8 +1278,8 @@
static void autoActivateFont(const String& name, CGFloat size)
{
auto fontName = name.createCFString();
- CFTypeRef keys[] = { kCTFontNameAttribute };
- CFTypeRef values[] = { fontName.get() };
+ CFTypeRef keys[] = { kCTFontNameAttribute, kCTFontEnabledAttribute };
+ CFTypeRef values[] = { fontName.get(), kCFBooleanTrue };
auto attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
auto descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
auto newFont = adoptCF(CTFontCreateWithFontDescriptor(descriptor.get(), size, nullptr));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes