Title: [252710] trunk
Revision
252710
Author
mmaxfi...@apple.com
Date
2019-11-20 14:29:44 -0800 (Wed, 20 Nov 2019)

Log Message

[Cocoa] Add ui-sans-serif as a sibling to ui-serif, ui-monospace, and ui-rounded
https://bugs.webkit.org/show_bug.cgi?id=204188

Reviewed by Simon Fraser.

Source/WebCore:

As per https://github.com/w3c/csswg-drafts/commit/cd0059a32a74c5a48630ce7c77292642dac70fd9#diff-dd2d54c50c872e1e303daebd4794d642

Test: fast/text/design-system-ui-sans-serif.html

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::fontWithFamilySpecialCase):
* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
(WebCore::matchSystemFontUse):

LayoutTests:

* fast/text/design-system-ui-sans-serif-expected.html: Added.
* fast/text/design-system-ui-sans-serif.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (252709 => 252710)


--- trunk/LayoutTests/ChangeLog	2019-11-20 22:25:43 UTC (rev 252709)
+++ trunk/LayoutTests/ChangeLog	2019-11-20 22:29:44 UTC (rev 252710)
@@ -1,3 +1,13 @@
+2019-11-20  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Add ui-sans-serif as a sibling to ui-serif, ui-monospace, and ui-rounded
+        https://bugs.webkit.org/show_bug.cgi?id=204188
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/design-system-ui-sans-serif-expected.html: Added.
+        * fast/text/design-system-ui-sans-serif.html: Added.
+
 2019-11-20  Truitt Savell  <tsav...@apple.com>
 
         Add platform specific expectations for High Sierra and Mojave for svg/custom/glyph-selection-arabic-forms.svg

Added: trunk/LayoutTests/fast/text/design-system-ui-sans-serif-expected.html (0 => 252710)


--- trunk/LayoutTests/fast/text/design-system-ui-sans-serif-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/design-system-ui-sans-serif-expected.html	2019-11-20 22:29:44 UTC (rev 252710)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: "WebFont";
+    src: local("system-ui");
+}
+</style>
+</head>
+<body>
+This test makes sure that <code>ui-sans-serif</code> matches <code>system-ui</code>.
+<div style="font: 72px system-ui;">HeJllo</div>
+<div style="font: 72px WebFont;">HeJllo</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/design-system-ui-sans-serif.html (0 => 252710)


--- trunk/LayoutTests/fast/text/design-system-ui-sans-serif.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/design-system-ui-sans-serif.html	2019-11-20 22:29:44 UTC (rev 252710)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: "WebFont";
+    src: local("ui-sans-serif");
+}
+</style>
+</head>
+<body>
+This test makes sure that <code>ui-sans-serif</code> matches <code>system-ui</code>.
+<div style="font: 72px ui-sans-serif;">HeJllo</div>
+<div style="font: 72px WebFont;">HeJllo</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (252709 => 252710)


--- trunk/Source/WebCore/ChangeLog	2019-11-20 22:25:43 UTC (rev 252709)
+++ trunk/Source/WebCore/ChangeLog	2019-11-20 22:29:44 UTC (rev 252710)
@@ -1,3 +1,19 @@
+2019-11-20  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Add ui-sans-serif as a sibling to ui-serif, ui-monospace, and ui-rounded
+        https://bugs.webkit.org/show_bug.cgi?id=204188
+
+        Reviewed by Simon Fraser.
+
+        As per https://github.com/w3c/csswg-drafts/commit/cd0059a32a74c5a48630ce7c77292642dac70fd9#diff-dd2d54c50c872e1e303daebd4794d642
+
+        Test: fast/text/design-system-ui-sans-serif.html
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::fontWithFamilySpecialCase):
+        * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
+        (WebCore::matchSystemFontUse):
+
 2019-11-19  Brian Burg  <bb...@apple.com>
 
         [Cocoa] Add _WKRemoteWebInspectorViewController SPI to set diagnostic logging delegate

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (252709 => 252710)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2019-11-20 22:25:43 UTC (rev 252709)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2019-11-20 22:29:44 UTC (rev 252710)
@@ -1269,8 +1269,9 @@
 
 static RetainPtr<CTFontRef> fontWithFamilySpecialCase(const AtomString& family, const FontDescription& fontDescription, float size, AllowUserInstalledFonts allowUserInstalledFonts)
 {
+    Optional<SystemFontDatabaseCoreText::ClientUse> designSystemUI;
+
 #if HAVE(DESIGN_SYSTEM_UI_FONTS)
-    Optional<SystemFontDatabaseCoreText::ClientUse> designSystemUI;
     if (equalLettersIgnoringASCIICase(family, "ui-serif"))
         designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUISerif;
     else if (equalLettersIgnoringASCIICase(family, "ui-monospace"))
@@ -1277,18 +1278,18 @@
         designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUIMonospace;
     else if (equalLettersIgnoringASCIICase(family, "ui-rounded"))
         designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUIRounded;
+#endif
 
+    if (equalLettersIgnoringASCIICase(family, "ui-sans-serif")) {
+        ASSERT(!designSystemUI);
+        designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUI;
+    }
+
     if (designSystemUI) {
         auto cascadeList = SystemFontDatabaseCoreText::singleton().cascadeList(fontDescription, family, *designSystemUI, allowUserInstalledFonts);
         if (!cascadeList.isEmpty())
             return createFontForInstalledFonts(cascadeList[0].get(), size, allowUserInstalledFonts);
     }
-#else
-    UNUSED_PARAM(family);
-    UNUSED_PARAM(fontDescription);
-    UNUSED_PARAM(size);
-    UNUSED_PARAM(allowUserInstalledFonts);
-#endif
 
     return nullptr;
 }

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp (252709 => 252710)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp	2019-11-20 22:25:43 UTC (rev 252709)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp	2019-11-20 22:29:44 UTC (rev 252710)
@@ -52,7 +52,8 @@
     if (equalLettersIgnoringASCIICase(string, "-webkit-system-font")
         || equalLettersIgnoringASCIICase(string, "-apple-system")
         || equalLettersIgnoringASCIICase(string, "-apple-system-font")
-        || equalLettersIgnoringASCIICase(string, "system-ui"))
+        || equalLettersIgnoringASCIICase(string, "system-ui")
+        || equalLettersIgnoringASCIICase(string, "ui-sans-serif"))
         return SystemFontDatabaseCoreText::ClientUse::ForSystemUI;
 
 #if HAVE(DESIGN_SYSTEM_UI_FONTS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to