[Cocoa] font-family:system-ui on Chinese systems don't get Chinese quote marks
https://bugs.webkit.org/show_bug.cgi?id=202778
<rdar://problem/52594556>

Reviewed by Simon Fraser.

Source/WebCore:

This was caught by fast/text/international/system-language/han-quotes.html,
but we didn't have time to fix it until now.

Test: fast/text/international/system-language/han-quotes.html

* platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
(WebCore::SystemFontDatabaseCoreText::createSystemUIFont):

LayoutTests:

* platform/mac/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@250989 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ab96aa0..6a1e376 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2019-10-10  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] font-family:system-ui on Chinese systems don't get Chinese quote marks
+        https://bugs.webkit.org/show_bug.cgi?id=202778
+        <rdar://problem/52594556>
+
+        Reviewed by Simon Fraser.
+
+        * platform/mac/TestExpectations:
+
 2019-10-10  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, tweak test to address flakiness on WK1.
diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations
index 6576eaa..5b4cbfd 100644
--- a/LayoutTests/platform/mac/TestExpectations
+++ b/LayoutTests/platform/mac/TestExpectations
@@ -1977,9 +1977,6 @@
 
 webkit.org/b/200258 [ Debug ] imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html [ Pass Failure ]
 
-# rdar://52594556 (Layout test fast/text/international/system-language/han-quotes.html is failing)
-[ Catalina+ ] fast/text/international/system-language/han-quotes.html [ ImageOnlyFailure ]
-
 webkit.org/b/200128 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video_timeupdate_on_seek.html [ Timeout Pass ]
 
 # rdar://52557916 (REGRESSION: fast/css/paint-order.html and fast/css/paint-order-shadow.html are failing)
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index a55e099..b85c1b7 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,21 @@
 2019-10-10  Myles C. Maxfield  <mmaxfield@apple.com>
 
+        [Cocoa] font-family:system-ui on Chinese systems don't get Chinese quote marks
+        https://bugs.webkit.org/show_bug.cgi?id=202778
+        <rdar://problem/52594556>
+
+        Reviewed by Simon Fraser.
+
+        This was caught by fast/text/international/system-language/han-quotes.html,
+        but we didn't have time to fix it until now.
+
+        Test: fast/text/international/system-language/han-quotes.html
+
+        * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
+        (WebCore::SystemFontDatabaseCoreText::createSystemUIFont):
+
+2019-10-10  Myles C. Maxfield  <mmaxfield@apple.com>
+
         FontFaceSet's ready promise is not always resolved
         https://bugs.webkit.org/show_bug.cgi?id=202548
 
diff --git a/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp b/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
index ac0e34b..e49ba1a 100644
--- a/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
+++ b/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
@@ -49,6 +49,8 @@
 
 RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createSystemUIFont(const CascadeListParameters& parameters, CFStringRef locale)
 {
+    if (locale && !CFStringGetLength(locale))
+        locale = nullptr;
     auto result = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, parameters.size, locale));
     ASSERT(result);
     return createFontByApplyingWeightItalicsAndFallbackBehavior(result.get(), parameters.weight, parameters.italic, parameters.size, parameters.allowUserInstalledFonts);