Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283030 => 283031)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-09-24 07:22:50 UTC (rev 283030)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-09-24 08:48:48 UTC (rev 283031)
@@ -1,3 +1,22 @@
+2021-09-24 Myles C. Maxfield <[email protected]>
+
+ Handle CSSOM style mutation of font-palette-values
+ https://bugs.webkit.org/show_bug.cgi?id=230448
+ <rdar://problem/83343481>
+
+ Reviewed by Antti Koivisto.
+
+ These tests are being upstreamed at https://github.com/web-platform-tests/wpt/pull/30939.
+
+ * web-platform-tests/css/css-fonts/palette-values-rule-add-2-expected.html: Added.
+ * web-platform-tests/css/css-fonts/palette-values-rule-add-2.html: Added.
+ * web-platform-tests/css/css-fonts/palette-values-rule-add-expected-mismatch.html: Added.
+ * web-platform-tests/css/css-fonts/palette-values-rule-add.html: Added.
+ * web-platform-tests/css/css-fonts/palette-values-rule-delete-2-expected.html: Added.
+ * web-platform-tests/css/css-fonts/palette-values-rule-delete-2.html: Added.
+ * web-platform-tests/css/css-fonts/palette-values-rule-delete-expected-mismatch.html: Added.
+ * web-platform-tests/css/css-fonts/palette-values-rule-delete.html: Added.
+
2021-09-24 Sihui Liu <[email protected]>
Add initial support for File System Access API
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-2-expected.html (0 => 283031)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-2-expected.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-2-expected.html 2021-09-24 08:48:48 UTC (rev 283031)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Tests that dynamically adding a @font-palette-values rule causes the necessary rendering update</title>
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<style>
+@font-face {
+ font-family: "Ahem-COLR";
+ src: url("resources/Ahem-COLOR-palettes.ttf") format("truetype");
+}
+
+@font-palette-values MyPalette {
+ font-family: "Ahem-COLR";
+ base-palette: 1;
+}
+</style>
+</head>
+<body>
+<div style="font: 48px 'Ahem-COLR'; font-palette: MyPalette;">A</div>
+</body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-2.html (0 => 283031)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-2.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-2.html 2021-09-24 08:48:48 UTC (rev 283031)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<meta charset="utf-8">
+<title>Tests that dynamically adding a @font-palette-values rule causes the necessary rendering update</title>
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<link rel="match" href=""
+<style>
+@font-face {
+ font-family: "Ahem-COLR";
+ src: url("resources/Ahem-COLOR-palettes.ttf") format("truetype");
+}
+</style>
+</head>
+<body>
+<div style="font: 48px 'Ahem-COLR'; font-palette: MyPalette;">A</div>
+<script>
+let count = 0;
+function tick() {
+ if (count > 3) {
+ let style = document.createElement("style");
+ document.head.appendChild(style);
+ style.sheet.insertRule(`
+ @font-palette-values MyPalette {
+ font-family: "Ahem-COLR";
+ base-palette: 1;
+ }`);
+ document.documentElement.classList.remove("reftest-wait");
+ } else {
+ ++count;
+ requestAnimationFrame(tick);
+ }
+}
+requestAnimationFrame(tick);
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-expected-mismatch.html (0 => 283031)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-expected-mismatch.html 2021-09-24 08:48:48 UTC (rev 283031)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Tests that dynamically adding a @font-palette-values rule causes the necessary rendering update</title>
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<style>
+@font-face {
+ font-family: "Ahem-COLR";
+ src: url("resources/Ahem-COLOR-palettes.ttf") format("truetype");
+}
+</style>
+</head>
+<body>
+<div style="font: 48px 'Ahem-COLR'; font-palette: MyPalette;">A</div>
+</body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add.html (0 => 283031)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add.html 2021-09-24 08:48:48 UTC (rev 283031)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<meta charset="utf-8">
+<title>Tests that dynamically adding a @font-palette-values rule causes the necessary rendering update</title>
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<link rel="mismatch" href=""
+<style>
+@font-face {
+ font-family: "Ahem-COLR";
+ src: url("resources/Ahem-COLOR-palettes.ttf") format("truetype");
+}
+</style>
+</head>
+<body>
+<div style="font: 48px 'Ahem-COLR'; font-palette: MyPalette;">A</div>
+<script>
+let count = 0;
+function tick() {
+ if (count > 3) {
+ let style = document.createElement("style");
+ document.head.appendChild(style);
+ style.sheet.insertRule(`
+ @font-palette-values MyPalette {
+ font-family: "Ahem-COLR";
+ base-palette: 1;
+ }`);
+ document.documentElement.classList.remove("reftest-wait");
+ } else {
+ ++count;
+ requestAnimationFrame(tick);
+ }
+}
+requestAnimationFrame(tick);
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-2-expected.html (0 => 283031)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-2-expected.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-2-expected.html 2021-09-24 08:48:48 UTC (rev 283031)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Tests that dynamically deleting a @font-palette-values rule causes the necessary rendering update</title>
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<style id="style">
+@font-face {
+ font-family: "Ahem-COLR";
+ src: url("resources/Ahem-COLOR-palettes.ttf") format("truetype");
+}
+</style>
+</head>
+<body>
+<div style="font: 48px 'Ahem-COLR'; font-palette: MyPalette;">A</div>
+</body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-2.html (0 => 283031)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-2.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-2.html 2021-09-24 08:48:48 UTC (rev 283031)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<meta charset="utf-8">
+<title>Tests that dynamically deleting a @font-palette-values rule causes the necessary rendering update</title>
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<link rel="match" href=""
+<style id="style">
+@font-face {
+ font-family: "Ahem-COLR";
+ src: url("resources/Ahem-COLOR-palettes.ttf") format("truetype");
+}
+
+@font-palette-values MyPalette {
+ font-family: "Ahem-COLR";
+ base-palette: 1;
+}
+</style>
+</head>
+<body>
+<div style="font: 48px 'Ahem-COLR'; font-palette: MyPalette;">A</div>
+<script>
+let count = 0;
+function tick() {
+ if (count > 3) {
+ document.getElementById("style").sheet.deleteRule(1);
+ document.documentElement.classList.remove("reftest-wait");
+ } else {
+ ++count;
+ requestAnimationFrame(tick);
+ }
+}
+requestAnimationFrame(tick);
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-expected-mismatch.html (0 => 283031)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-expected-mismatch.html 2021-09-24 08:48:48 UTC (rev 283031)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Tests that dynamically deleting a @font-palette-values rule causes the necessary rendering update</title>
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<style id="style">
+@font-face {
+ font-family: "Ahem-COLR";
+ src: url("resources/Ahem-COLOR-palettes.ttf") format("truetype");
+}
+
+@font-palette-values MyPalette {
+ font-family: "Ahem-COLR";
+ base-palette: 1;
+}
+</style>
+</head>
+<body>
+<div style="font: 48px 'Ahem-COLR'; font-palette: MyPalette;">A</div>
+</body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete.html (0 => 283031)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete.html 2021-09-24 08:48:48 UTC (rev 283031)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<meta charset="utf-8">
+<title>Tests that dynamically deleting a @font-palette-values rule causes the necessary rendering update</title>
+<link rel="help" href=""
+<link rel="author" title="Myles C. Maxfield" href=""
+<link rel="mismatch" href=""
+<style id="style">
+@font-face {
+ font-family: "Ahem-COLR";
+ src: url("resources/Ahem-COLOR-palettes.ttf") format("truetype");
+}
+
+@font-palette-values MyPalette {
+ font-family: "Ahem-COLR";
+ base-palette: 1;
+}
+</style>
+</head>
+<body>
+<div style="font: 48px 'Ahem-COLR'; font-palette: MyPalette;">A</div>
+<script>
+let count = 0;
+function tick() {
+ if (count > 3) {
+ document.getElementById("style").sheet.deleteRule(1);
+ document.documentElement.classList.remove("reftest-wait");
+ } else {
+ ++count;
+ requestAnimationFrame(tick);
+ }
+}
+requestAnimationFrame(tick);
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (283030 => 283031)
--- trunk/Source/WebCore/ChangeLog 2021-09-24 07:22:50 UTC (rev 283030)
+++ trunk/Source/WebCore/ChangeLog 2021-09-24 08:48:48 UTC (rev 283031)
@@ -1,3 +1,30 @@
+2021-09-24 Myles C. Maxfield <[email protected]>
+
+ Handle CSSOM style mutation of font-palette-values
+ https://bugs.webkit.org/show_bug.cgi?id=230448
+ <rdar://problem/83343481>
+
+ Reviewed by Antti Koivisto.
+
+ The CSSSegmentedFontFace cache needs to be sensitive to FontPaletteValues.
+
+ Tests: imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add-2.html
+ imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-add.html
+ imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete-2.html
+ imported/w3c/web-platform-tests/css/css-fonts/palette-values-rule-delete.html
+
+ * css/CSSSegmentedFontFace.cpp:
+ (WebCore::CSSSegmentedFontFace::fontRanges):
+ * css/CSSSegmentedFontFace.h:
+ * platform/graphics/FontCache.h:
+ (WTF::DefaultHash<WebCore::FontDescriptionKey>::hash):
+ (WTF::DefaultHash<WebCore::FontDescriptionKey>::equal):
+ (WebCore::FontDescriptionKeyHash::hash): Deleted.
+ (WebCore::FontDescriptionKeyHash::equal): Deleted.
+ * platform/graphics/FontPaletteValues.h:
+ (WTF::DefaultHash<WebCore::FontPaletteValues>::hash):
+ (WTF::DefaultHash<WebCore::FontPaletteValues>::equal):
+
2021-09-24 Brandon Stewart <[email protected]>
[RenderTreeUpdater] NULL ptr deref in updateRenderTree
Modified: trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp (283030 => 283031)
--- trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp 2021-09-24 07:22:50 UTC (rev 283030)
+++ trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp 2021-09-24 08:48:48 UTC (rev 283031)
@@ -112,7 +112,7 @@
FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescription, const FontPaletteValues& fontPaletteValues)
{
- auto addResult = m_cache.add(FontDescriptionKey(fontDescription), FontRanges());
+ auto addResult = m_cache.add(std::make_tuple(FontDescriptionKey(fontDescription), fontPaletteValues), FontRanges());
auto& ranges = addResult.iterator->value;
if (!addResult.isNewEntry)
Modified: trunk/Source/WebCore/css/CSSSegmentedFontFace.h (283030 => 283031)
--- trunk/Source/WebCore/css/CSSSegmentedFontFace.h 2021-09-24 07:22:50 UTC (rev 283030)
+++ trunk/Source/WebCore/css/CSSSegmentedFontFace.h 2021-09-24 08:48:48 UTC (rev 283031)
@@ -62,7 +62,8 @@
CSSSegmentedFontFace();
void fontLoaded(CSSFontFace&) final;
- HashMap<FontDescriptionKey, FontRanges, FontDescriptionKeyHash, WTF::SimpleClassHashTraits<FontDescriptionKey>> m_cache;
+ // FIXME: Add support for font-feature-values in the key for this cache.
+ HashMap<std::tuple<FontDescriptionKey, FontPaletteValues>, FontRanges> m_cache;
Vector<Ref<CSSFontFace>, 1> m_fontFaces;
};
Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (283030 => 283031)
--- trunk/Source/WebCore/platform/graphics/FontCache.h 2021-09-24 07:22:50 UTC (rev 283030)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h 2021-09-24 08:48:48 UTC (rev 283031)
@@ -40,6 +40,7 @@
#include <limits.h>
#include <wtf/FastMalloc.h>
#include <wtf/Forward.h>
+#include <wtf/HashFunctions.h>
#include <wtf/HashTraits.h>
#include <wtf/ListHashSet.h>
#include <wtf/PointerComparison.h>
@@ -216,12 +217,23 @@
add(hasher, *key.m_rareData);
}
-struct FontDescriptionKeyHash {
- static unsigned hash(const FontDescriptionKey& key) { return computeHash(key); }
- static bool equal(const FontDescriptionKey& a, const FontDescriptionKey& b) { return a == b; }
+} // namespace WebCore
+
+namespace WTF {
+
+template<> struct DefaultHash<WebCore::FontDescriptionKey> {
+ static unsigned hash(const WebCore::FontDescriptionKey& key) { return computeHash(key); }
+ static bool equal(const WebCore::FontDescriptionKey& a, const WebCore::FontDescriptionKey& b) { return a == b; }
static constexpr bool safeToCompareToEmptyOrDeleted = true;
};
+template<> struct HashTraits<WebCore::FontDescriptionKey> : WTF::SimpleClassHashTraits<WebCore::FontDescriptionKey> {
+};
+
+}
+
+namespace WebCore {
+
// This class holds the name of a font family, and defines hashing and == of this name to
// use the rules for font family names instead of using straight string comparison.
class FontFamilyName {
Modified: trunk/Source/WebCore/platform/graphics/FontPaletteValues.h (283030 => 283031)
--- trunk/Source/WebCore/platform/graphics/FontPaletteValues.h 2021-09-24 07:22:50 UTC (rev 283030)
+++ trunk/Source/WebCore/platform/graphics/FontPaletteValues.h 2021-09-24 08:48:48 UTC (rev 283031)
@@ -27,6 +27,7 @@
#include "Color.h"
#include "Gradient.h"
+#include <wtf/HashFunctions.h>
#include <wtf/Variant.h>
#include <wtf/Vector.h>
#include <wtf/text/AtomString.h>
@@ -78,4 +79,14 @@
add(hasher, fontPaletteValues.overrideColor());
}
+} // namespace WebCore
+
+namespace WTF {
+
+template<> struct DefaultHash<WebCore::FontPaletteValues> {
+ static unsigned hash(const WebCore::FontPaletteValues& key) { return computeHash(key); }
+ static bool equal(const WebCore::FontPaletteValues& a, const WebCore::FontPaletteValues& b) { return a == b; }
+ static constexpr bool safeToCompareToEmptyOrDeleted = true;
+};
+
}