Title: [283794] trunk
Revision
283794
Author
[email protected]
Date
2021-10-08 00:57:33 -0700 (Fri, 08 Oct 2021)

Log Message

font-families inside @font-palette-values need to be case insensitive
https://bugs.webkit.org/show_bug.cgi?id=231215
<rdar://problem/83871643>

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-fonts/font-palette-33-expected.html: Added.
* web-platform-tests/css/css-fonts/font-palette-33.html: Added.
* web-platform-tests/css/css-fonts/font-palette-34-expected.html: Added.
* web-platform-tests/css/css-fonts/font-palette-34.html: Added.

Source/WebCore:

https://drafts.csswg.org/css-fonts-4/#font-family-2-desc says:
> The value of this descriptor matches the definition of the <family-name> for the font-family property.

Tests: imported/w3c/web-platform-tests/css/css-fonts/font-palette-33.html
       imported/w3c/web-platform-tests/css/css-fonts/font-palette-34.html

* css/CSSFontSelector.h:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283793 => 283794)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-08 06:45:35 UTC (rev 283793)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-08 07:57:33 UTC (rev 283794)
@@ -1,3 +1,16 @@
+2021-10-08  Myles C. Maxfield  <[email protected]>
+
+        font-families inside @font-palette-values need to be case insensitive
+        https://bugs.webkit.org/show_bug.cgi?id=231215
+        <rdar://problem/83871643>
+
+        Reviewed by Antti Koivisto.
+
+        * web-platform-tests/css/css-fonts/font-palette-33-expected.html: Added.
+        * web-platform-tests/css/css-fonts/font-palette-33.html: Added.
+        * web-platform-tests/css/css-fonts/font-palette-34-expected.html: Added.
+        * web-platform-tests/css/css-fonts/font-palette-34.html: Added.
+
 2021-10-07  Alexey Shvayka  <[email protected]>
 
         `highWaterMark` should be a readonly WebIDL attribute of queuing strategies

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-33-expected.html (0 => 283794)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-33-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-33-expected.html	2021-10-08 07:57:33 UTC (rev 283794)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Tests for font-palette and @font-palette-values</title>
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<style>
+@font-face {
+    font-family: "COLR-test-font";
+    src: url("resources/COLR-palettes-test-font.ttf") format("truetype");
+}
+
+@font-palette-values --MyPalette {
+    font-family: "COLR-test-font";
+    base-palette: 2;
+}
+</style>
+</head>
+<body>
+<div id="target" style="font: 48px 'COLR-test-font'; font-palette: --MyPalette">A</div>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-33.html (0 => 283794)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-33.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-33.html	2021-10-08 07:57:33 UTC (rev 283794)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Tests for font-palette and @font-palette-values</title>
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<link rel="match" href=""
+<style>
+@font-face {
+    font-family: "COLR-test-font";
+    src: url("resources/COLR-palettes-test-font.ttf") format("truetype");
+}
+
+@font-palette-values --MyPalette {
+    font-family: "COLR-test-font";
+    base-palette: 1;
+}
+
+@font-palette-values --MyPalette {
+    font-family: "CoLr-tEsT-FoNt";
+    base-palette: 2;
+}
+</style>
+</head>
+<body>
+<div id="target" style="font: 48px 'COLR-test-font'; font-palette: --MyPalette;">A</div>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-34-expected.html (0 => 283794)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-34-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-34-expected.html	2021-10-08 07:57:33 UTC (rev 283794)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Tests for font-palette and @font-palette-values</title>
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<style>
+@font-face {
+    font-family: "COLR-test-font";
+    src: url("resources/COLR-palettes-test-font.ttf") format("truetype");
+}
+
+@font-palette-values --MyPalette {
+    font-family: "COLR-test-font";
+    base-palette: 1;
+}
+</style>
+</head>
+<body>
+<div id="target" style="font: 48px 'COLR-test-font'; font-palette: --MyPalette">A</div>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-34.html (0 => 283794)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-34.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-34.html	2021-10-08 07:57:33 UTC (rev 283794)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Tests for font-palette and @font-palette-values</title>
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<link rel="match" href=""
+<style>
+@font-face {
+    font-family: "COLR-test-font";
+    src: url("resources/COLR-palettes-test-font.ttf") format("truetype");
+}
+
+@font-palette-values --MyPalette {
+    font-family: "COLR-test-font";
+    base-palette: 1;
+}
+
+@font-palette-values --MyPaLeTte {
+    font-family: "COLR-test-font";
+    base-palette: 2;
+}
+</style>
+</head>
+<body>
+<div id="target" style="font: 48px 'COLR-test-font'; font-palette: --MyPalette;">A</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (283793 => 283794)


--- trunk/Source/WebCore/ChangeLog	2021-10-08 06:45:35 UTC (rev 283793)
+++ trunk/Source/WebCore/ChangeLog	2021-10-08 07:57:33 UTC (rev 283794)
@@ -1,3 +1,19 @@
+2021-10-08  Myles C. Maxfield  <[email protected]>
+
+        font-families inside @font-palette-values need to be case insensitive
+        https://bugs.webkit.org/show_bug.cgi?id=231215
+        <rdar://problem/83871643>
+
+        Reviewed by Antti Koivisto.
+
+        https://drafts.csswg.org/css-fonts-4/#font-family-2-desc says:
+        > The value of this descriptor matches the definition of the <family-name> for the font-family property.
+
+        Tests: imported/w3c/web-platform-tests/css/css-fonts/font-palette-33.html
+               imported/w3c/web-platform-tests/css/css-fonts/font-palette-34.html
+
+        * css/CSSFontSelector.h:
+
 2021-10-07  Simon Fraser  <[email protected]>
 
         Plumb "animated scroll did end" back from the scrolling tree

Modified: trunk/Source/WebCore/css/CSSFontSelector.h (283793 => 283794)


--- trunk/Source/WebCore/css/CSSFontSelector.h	2021-10-08 06:45:35 UTC (rev 283793)
+++ trunk/Source/WebCore/css/CSSFontSelector.h	2021-10-08 07:57:33 UTC (rev 283794)
@@ -128,8 +128,19 @@
     Ref<CSSFontFaceSet> m_cssFontFaceSet;
     HashSet<FontSelectorClient*> m_clients;
 
-    HashMap<std::pair<AtomString, AtomString>, FontPaletteValues> m_paletteMap;
+    struct PaletteMapHash : WTF::DefaultHash<std::pair<AtomString, AtomString>> {
+        static unsigned hash(const std::pair<AtomString, AtomString>& key)
+        {
+            return pairIntHash(ASCIICaseInsensitiveHash::hash(key.first), WTF::DefaultHash<AtomString>::hash(key.second));
+        }
 
+        static bool equal(const std::pair<AtomString, AtomString>& a, const std::pair<AtomString, AtomString>& b)
+        {
+            return ASCIICaseInsensitiveHash::equal(a.first, b.first) && WTF::DefaultHash<AtomString>::equal(a.second, b.second);
+        }
+    };
+    HashMap<std::pair<AtomString, AtomString>, FontPaletteValues, PaletteMapHash> m_paletteMap;
+
     HashSet<RefPtr<CSSFontFace>> m_cssConnectionsPossiblyToRemove;
     HashSet<RefPtr<StyleRuleFontFace>> m_cssConnectionsEncounteredDuringBuild;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to