Title: [283752] trunk
Revision
283752
Author
[email protected]
Date
2021-10-07 16:05:49 -0700 (Thu, 07 Oct 2021)

Log Message

Stop parsing font palette things that we can't implement
https://bugs.webkit.org/show_bug.cgi?id=230799
<rdar://problem/83537772>

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html:

Source/WebCore:

We can't implement the <string> values in base-palette and override-colors. It's better
not to parse them, so this behavior can at least be feature detected by JS reading the
serialized value that was parsed.

I'm investigating changing the spec to disallow these unimplementable things in
https://github.com/w3c/csswg-drafts/issues/6627.

For base-palette, we were representing the absence of the descriptor by making the internal
representation hold a null string. Now that we're removing the string value from the internal
representation, this is now being represented by using an std::optional instead.

Test: imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html

* css/CSSFontPaletteValuesRule.cpp:
(WebCore::CSSFontPaletteValuesRule::basePalette const):
(WebCore::CSSFontPaletteValuesRule::overrideColors const):
(WebCore::CSSFontPaletteValuesRule::cssText const):
* css/StyleRule.cpp:
(WebCore::StyleRuleFontPaletteValues::StyleRuleFontPaletteValues):
* css/StyleRule.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeFontPaletteValuesRule):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeBasePaletteDescriptor):
(WebCore::consumeOverrideColorsDescriptor):
* platform/graphics/FontPaletteValues.h:
(WebCore::FontPaletteIndex::operator bool const):
(WebCore::FontPaletteIndex::operator== const):
(WebCore::add):
(WebCore::FontPaletteValues::FontPaletteValues):
(WebCore::FontPaletteValues::basePalette const):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::addAttributesForCustomFontPalettes):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283751 => 283752)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-07 23:05:49 UTC (rev 283752)
@@ -1,3 +1,13 @@
+2021-10-07  Myles C. Maxfield  <[email protected]>
+
+        Stop parsing font palette things that we can't implement
+        https://bugs.webkit.org/show_bug.cgi?id=230799
+        <rdar://problem/83537772>
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html:
+
 2021-10-07  Aditya Keerthi  <[email protected]>
 
         [css-ui] Parsing support for accent-color

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html (283751 => 283752)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html	2021-10-07 23:05:49 UTC (rev 283752)
@@ -144,8 +144,8 @@
     assert_equals(text.indexOf("base-palette: \"baz\""), -1);
     assert_not_equals(text.indexOf("base-palette: 2;"), -1);
     assert_equals(text.indexOf("override-colors: \"a\""), -1);
-    assert_equals(text.indexOf("override-colors: 3"), -1);
-    assert_not_equals(text.indexOf("override-colors: \"b\""), -1);
+    assert_not_equals(text.indexOf("override-colors: 3"), -1);
+    assert_equals(text.indexOf("override-colors: \"b\""), -1);
 });
 
 test(function() {
@@ -153,14 +153,14 @@
     assert_equals(rule.name, "--C");
     assert_equals(rule.fontFamily, "bar");
     assert_equals(rule.basePalette, "2");
-    assert_equals(rule.overrideColors, "\"b\" rgb(17, 34, 51)");
+    assert_equals(rule.overrideColors, "3 rgb(17, 34, 51)");
 });
 
 test(function() {
     let text = rules[3].cssText;
     assert_equals(text.indexOf("base-palette: \"foo\";"), -1);
-    assert_equals(text.indexOf("base-palette: 1"), -1);
-    assert_not_equals(text.indexOf("base-palette: \"bar\";"), -1);
+    assert_not_equals(text.indexOf("base-palette: 1"), -1);
+    assert_equals(text.indexOf("base-palette: \"bar\";"), -1);
     assert_equals(text.indexOf("override-colors: 3"), -1);
     assert_equals(text.indexOf("override-colors: \"baz\""), -1);
     assert_not_equals(text.indexOf("override-colors: 4"), -1);
@@ -170,7 +170,7 @@
     let rule = rules[3];
     assert_equals(rule.name, "--D");
     assert_equals(rule.fontFamily, "");
-    assert_equals(rule.basePalette, "bar");
+    assert_equals(rule.basePalette, "1");
     assert_equals(rule.overrideColors.indexOf("),"), -1);
     assert_equals(rule.overrideColors.indexOf("4 "), 0);
     assert_not_equals(rule.overrideColors.indexOf("rgb"), -1);

Modified: trunk/Source/WebCore/ChangeLog (283751 => 283752)


--- trunk/Source/WebCore/ChangeLog	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/Source/WebCore/ChangeLog	2021-10-07 23:05:49 UTC (rev 283752)
@@ -1,3 +1,45 @@
+2021-10-07  Myles C. Maxfield  <[email protected]>
+
+        Stop parsing font palette things that we can't implement
+        https://bugs.webkit.org/show_bug.cgi?id=230799
+        <rdar://problem/83537772>
+
+        Reviewed by Simon Fraser.
+
+        We can't implement the <string> values in base-palette and override-colors. It's better
+        not to parse them, so this behavior can at least be feature detected by JS reading the
+        serialized value that was parsed.
+
+        I'm investigating changing the spec to disallow these unimplementable things in
+        https://github.com/w3c/csswg-drafts/issues/6627.
+
+        For base-palette, we were representing the absence of the descriptor by making the internal
+        representation hold a null string. Now that we're removing the string value from the internal
+        representation, this is now being represented by using an std::optional instead.
+
+        Test: imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-values-valid.html
+
+        * css/CSSFontPaletteValuesRule.cpp:
+        (WebCore::CSSFontPaletteValuesRule::basePalette const):
+        (WebCore::CSSFontPaletteValuesRule::overrideColors const):
+        (WebCore::CSSFontPaletteValuesRule::cssText const):
+        * css/StyleRule.cpp:
+        (WebCore::StyleRuleFontPaletteValues::StyleRuleFontPaletteValues):
+        * css/StyleRule.h:
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::CSSParserImpl::consumeFontPaletteValuesRule):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeBasePaletteDescriptor):
+        (WebCore::consumeOverrideColorsDescriptor):
+        * platform/graphics/FontPaletteValues.h:
+        (WebCore::FontPaletteIndex::operator bool const):
+        (WebCore::FontPaletteIndex::operator== const):
+        (WebCore::add):
+        (WebCore::FontPaletteValues::FontPaletteValues):
+        (WebCore::FontPaletteValues::basePalette const):
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::addAttributesForCustomFontPalettes):
+
 2021-10-07  Tim Horton  <[email protected]>
 
         BifurcatedGraphicsContext doesn't bifurcate draw{Tiled}Image

Modified: trunk/Source/WebCore/css/CSSFontPaletteValuesRule.cpp (283751 => 283752)


--- trunk/Source/WebCore/css/CSSFontPaletteValuesRule.cpp	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/Source/WebCore/css/CSSFontPaletteValuesRule.cpp	2021-10-07 23:05:49 UTC (rev 283752)
@@ -58,17 +58,16 @@
 
 String CSSFontPaletteValuesRule::basePalette() const
 {
-    switch (m_fontPaletteValuesRule->basePalette().type) {
+    if (!m_fontPaletteValuesRule->basePalette())
+        return StringImpl::empty();
+
+    switch (m_fontPaletteValuesRule->basePalette()->type) {
     case FontPaletteIndex::Type::Light:
         return "light"_s;
     case FontPaletteIndex::Type::Dark:
         return "dark"_s;
     case FontPaletteIndex::Type::Integer:
-        return makeString(m_fontPaletteValuesRule->basePalette().integer);
-    case FontPaletteIndex::Type::String:
-        if (!m_fontPaletteValuesRule->basePalette().string.isNull())
-            return m_fontPaletteValuesRule->basePalette().string;
-        return StringImpl::empty();
+        return makeString(m_fontPaletteValuesRule->basePalette()->integer);
     }
     RELEASE_ASSERT_NOT_REACHED();
 }
@@ -80,12 +79,7 @@
         if (i)
             result.append(", ");
         const auto& item = m_fontPaletteValuesRule->overrideColors()[i];
-        WTF::switchOn(item.first, [&] (const AtomString& string) {
-            result.append(serializeString(string));
-        }, [&] (int64_t index) {
-            result.append(index);
-        });
-        result.append(' ', serializationForCSS(item.second));
+        result.append(item.first, ' ', serializationForCSS(item.second));
     }
     return result.toString();
 }
@@ -97,20 +91,18 @@
     if (!m_fontPaletteValuesRule->fontFamily().isNull())
         builder.append("font-family: ", m_fontPaletteValuesRule->fontFamily(), "; ");
 
-    switch (m_fontPaletteValuesRule->basePalette().type) {
-    case FontPaletteIndex::Type::Light:
-        builder.append("base-palette: light; ");
-        break;
-    case FontPaletteIndex::Type::Dark:
-        builder.append("base-palette: dark; ");
-        break;
-    case FontPaletteIndex::Type::Integer:
-        builder.append("base-palette: ", m_fontPaletteValuesRule->basePalette().integer, "; ");
-        break;
-    case FontPaletteIndex::Type::String:
-        if (!m_fontPaletteValuesRule->basePalette().string.isNull())
-            builder.append("base-palette: ", serializeString(m_fontPaletteValuesRule->basePalette().string), "; ");
-        break;
+    if (m_fontPaletteValuesRule->basePalette()) {
+        switch (m_fontPaletteValuesRule->basePalette()->type) {
+        case FontPaletteIndex::Type::Light:
+            builder.append("base-palette: light; ");
+            break;
+        case FontPaletteIndex::Type::Dark:
+            builder.append("base-palette: dark; ");
+            break;
+        case FontPaletteIndex::Type::Integer:
+            builder.append("base-palette: ", m_fontPaletteValuesRule->basePalette()->integer, "; ");
+            break;
+        }
     }
 
     if (!m_fontPaletteValuesRule->overrideColors().isEmpty()) {
@@ -118,13 +110,7 @@
         for (size_t i = 0; i < m_fontPaletteValuesRule->overrideColors().size(); ++i) {
             if (i)
                 builder.append(',');
-            builder.append(' ');
-            WTF::switchOn(m_fontPaletteValuesRule->overrideColors()[i].first, [&] (const AtomString& name) {
-                builder.append(serializeString(name.string()));
-            }, [&] (unsigned index) {
-                builder.append(index);
-            });
-            builder.append(' ', serializationForCSS(m_fontPaletteValuesRule->overrideColors()[i].second));
+            builder.append(' ', m_fontPaletteValuesRule->overrideColors()[i].first, ' ', serializationForCSS(m_fontPaletteValuesRule->overrideColors()[i].second));
         }
         builder.append("; ");
     }

Modified: trunk/Source/WebCore/css/StyleRule.cpp (283751 => 283752)


--- trunk/Source/WebCore/css/StyleRule.cpp	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/Source/WebCore/css/StyleRule.cpp	2021-10-07 23:05:49 UTC (rev 283752)
@@ -330,7 +330,7 @@
     return downcast<MutableStyleProperties>(m_properties.get());
 }
 
-StyleRuleFontPaletteValues::StyleRuleFontPaletteValues(const AtomString& name, const AtomString& fontFamily, const FontPaletteIndex& basePalette, Vector<FontPaletteValues::OverriddenColor>&& overrideColors)
+StyleRuleFontPaletteValues::StyleRuleFontPaletteValues(const AtomString& name, const AtomString& fontFamily, std::optional<FontPaletteIndex> basePalette, Vector<FontPaletteValues::OverriddenColor>&& overrideColors)
     : StyleRuleBase(StyleRuleType::FontPaletteValues)
     , m_name(name)
     , m_fontFamily(fontFamily)

Modified: trunk/Source/WebCore/css/StyleRule.h (283751 => 283752)


--- trunk/Source/WebCore/css/StyleRule.h	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/Source/WebCore/css/StyleRule.h	2021-10-07 23:05:49 UTC (rev 283752)
@@ -159,7 +159,7 @@
 
 class StyleRuleFontPaletteValues final : public StyleRuleBase {
 public:
-    static Ref<StyleRuleFontPaletteValues> create(const AtomString& name, const AtomString& fontFamily, const FontPaletteIndex& basePalette, Vector<FontPaletteValues::OverriddenColor>&& overrideColors)
+    static Ref<StyleRuleFontPaletteValues> create(const AtomString& name, const AtomString& fontFamily, std::optional<FontPaletteIndex> basePalette, Vector<FontPaletteValues::OverriddenColor>&& overrideColors)
     {
         return adoptRef(*new StyleRuleFontPaletteValues(name, fontFamily, basePalette, WTFMove(overrideColors)));
     }
@@ -181,7 +181,7 @@
         return m_fontPaletteValues;
     }
 
-    const FontPaletteIndex& basePalette() const
+    std::optional<FontPaletteIndex> basePalette() const
     {
         return m_fontPaletteValues.basePalette();
     }
@@ -194,7 +194,7 @@
     Ref<StyleRuleFontPaletteValues> copy() const { return adoptRef(*new StyleRuleFontPaletteValues(*this)); }
 
 private:
-    StyleRuleFontPaletteValues(const AtomString& name, const AtomString& fontFamily, const FontPaletteIndex& basePalette, Vector<FontPaletteValues::OverriddenColor>&& overrideColors);
+    StyleRuleFontPaletteValues(const AtomString& name, const AtomString& fontFamily, std::optional<FontPaletteIndex> basePalette, Vector<FontPaletteValues::OverriddenColor>&& overrideColors);
     StyleRuleFontPaletteValues(const StyleRuleFontPaletteValues&);
 
     AtomString m_name;

Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (283751 => 283752)


--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2021-10-07 23:05:49 UTC (rev 283752)
@@ -680,12 +680,10 @@
     if (auto fontFamilyValue = properties->getPropertyCSSValue(CSSPropertyFontFamily))
         fontFamily = downcast<CSSPrimitiveValue>(*fontFamilyValue).fontFamily().familyName;
 
-    FontPaletteIndex basePalette;
+    std::optional<FontPaletteIndex> basePalette;
     if (auto basePaletteValue = properties->getPropertyCSSValue(CSSPropertyBasePalette)) {
         const auto& primitiveValue = downcast<CSSPrimitiveValue>(*basePaletteValue);
-        if (primitiveValue.isString())
-            basePalette = FontPaletteIndex(primitiveValue.stringValue());
-        else if (primitiveValue.isNumber())
+        if (primitiveValue.isNumber())
             basePalette = FontPaletteIndex(primitiveValue.value<unsigned>());
         else if (primitiveValue.valueID() == CSSValueLight)
             basePalette = FontPaletteIndex(FontPaletteIndex::Type::Light);
@@ -697,20 +695,16 @@
     if (auto overrideColorsValue = properties->getPropertyCSSValue(CSSPropertyOverrideColors)) {
         const auto& list = downcast<CSSValueList>(*overrideColorsValue);
         for (const auto& item : list) {
-            FontPaletteValues::PaletteColorIndex key(nullAtom());
             const auto& pair = downcast<CSSFontPaletteValuesOverrideColorsValue>(item.get());
-            if (pair.key().isString())
-                key = pair.key().stringValue();
-            else if (pair.key().isNumber())
-                key = pair.key().value<unsigned>();
-            else
+            if (!pair.key().isNumber())
                 continue;
+            unsigned key = pair.key().value<unsigned>();
             Color color = pair.color().isRGBColor() ? pair.color().color() : StyleColor::colorFromKeyword(pair.color().valueID(), { });
             overrideColors.append(std::make_pair(key, color));
         }
     }
 
-    return StyleRuleFontPaletteValues::create(name->stringValue(), fontFamily, basePalette, WTFMove(overrideColors));
+    return StyleRuleFontPaletteValues::create(name->stringValue(), fontFamily, WTFMove(basePalette), WTFMove(overrideColors));
 }
 
 RefPtr<StyleRuleKeyframes> CSSParserImpl::consumeKeyframesRule(bool webkitPrefixed, CSSParserTokenRange prelude, CSSParserTokenRange block)

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (283751 => 283752)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-10-07 23:05:49 UTC (rev 283752)
@@ -4855,8 +4855,6 @@
 {
     if (auto result = consumeIdent<CSSValueLight, CSSValueDark>(range))
         return result;
-    if (auto result = consumeString(range))
-        return result;
     return consumeInteger(range, 0);
 }
 
@@ -4864,11 +4862,7 @@
 {
     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
     do {
-        RefPtr<CSSPrimitiveValue> key;
-        if (range.peek().type() == StringToken)
-            key = consumeString(range);
-        else
-            key = consumeInteger(range, 0);
+        auto key = consumeInteger(range, 0);
         if (!key)
             return nullptr;
 

Modified: trunk/Source/WebCore/platform/graphics/FontPaletteValues.h (283751 => 283752)


--- trunk/Source/WebCore/platform/graphics/FontPaletteValues.h	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/Source/WebCore/platform/graphics/FontPaletteValues.h	2021-10-07 23:05:49 UTC (rev 283752)
@@ -51,15 +51,9 @@
     {
     }
 
-    FontPaletteIndex(const AtomString& string)
-        : type(Type::String)
-        , string(string)
-    {
-    }
-
     operator bool() const
     {
-        return type != Type::String || !string.isNull();
+        return type != Type::Integer || integer;
     }
 
     bool operator==(const FontPaletteIndex& other) const
@@ -68,8 +62,6 @@
             return false;
         if (type == Type::Integer)
             return integer == other.integer;
-        if (type == Type::String)
-            return string == other.string;
         return true;
     }
 
@@ -81,12 +73,11 @@
     enum class Type : uint8_t {
         Light,
         Dark,
-        Integer,
-        String
-    } type { Type::String };
+        Integer
+    };
+    Type type { Type::Integer };
 
     unsigned integer { 0 };
-    AtomString string;
 };
 
 inline void add(Hasher& hasher, const FontPaletteIndex& paletteIndex)
@@ -94,24 +85,21 @@
     add(hasher, paletteIndex.type);
     if (paletteIndex.type == FontPaletteIndex::Type::Integer)
         add(hasher, paletteIndex.integer);
-    else if (paletteIndex.type == FontPaletteIndex::Type::String)
-        add(hasher, paletteIndex.string);
 }
 
 class FontPaletteValues {
 public:
-    using PaletteColorIndex = Variant<AtomString, unsigned>;
-    using OverriddenColor = std::pair<PaletteColorIndex, Color>;
+    using OverriddenColor = std::pair<unsigned, Color>;
 
     FontPaletteValues() = default;
 
-    FontPaletteValues(const FontPaletteIndex& basePalette, Vector<OverriddenColor>&& overrideColors)
+    FontPaletteValues(std::optional<FontPaletteIndex> basePalette, Vector<OverriddenColor>&& overrideColors)
         : m_basePalette(basePalette)
         , m_overrideColors(WTFMove(overrideColors))
     {
     }
 
-    const FontPaletteIndex& basePalette() const
+    std::optional<FontPaletteIndex> basePalette() const
     {
         return m_basePalette;
     }
@@ -137,7 +125,7 @@
     }
 
 private:
-    FontPaletteIndex m_basePalette;
+    std::optional<FontPaletteIndex> m_basePalette;
     Vector<OverriddenColor> m_overrideColors;
 };
 

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


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2021-10-07 23:00:15 UTC (rev 283751)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2021-10-07 23:05:49 UTC (rev 283752)
@@ -457,39 +457,33 @@
     CFDictionaryAddValue(attributes, kCTFontPaletteAttribute, number.get());
 }
 
-static void addAttributesForCustomFontPalettes(CFMutableDictionaryRef attributes, const FontPaletteIndex& basePalette, const Vector<FontPaletteValues::OverriddenColor>& overrideColors)
+static void addAttributesForCustomFontPalettes(CFMutableDictionaryRef attributes, std::optional<FontPaletteIndex> basePalette, const Vector<FontPaletteValues::OverriddenColor>& overrideColors)
 {
-    switch (basePalette.type) {
-    case FontPaletteIndex::Type::Light:
-        addLightPalette(attributes);
-        break;
-    case FontPaletteIndex::Type::Dark:
-        addDarkPalette(attributes);
-        break;
-    case FontPaletteIndex::Type::Integer: {
-        int64_t rawIndex = basePalette.integer; // There is no kCFNumberUIntType.
-        auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &rawIndex));
-        CFDictionaryAddValue(attributes, kCTFontPaletteAttribute, number.get());
-        break;
+    if (basePalette) {
+        switch (basePalette->type) {
+        case FontPaletteIndex::Type::Light:
+            addLightPalette(attributes);
+            break;
+        case FontPaletteIndex::Type::Dark:
+            addDarkPalette(attributes);
+            break;
+        case FontPaletteIndex::Type::Integer: {
+            int64_t rawIndex = basePalette->integer; // There is no kCFNumberUIntType.
+            auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &rawIndex));
+            CFDictionaryAddValue(attributes, kCTFontPaletteAttribute, number.get());
+            break;
+        }
+        }
     }
-    case FontPaletteIndex::Type::String:
-        // This is unimplementable in Core Text.
-        break;
-    }
 
     if (!overrideColors.isEmpty()) {
         auto overrideDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
         for (const auto& pair : overrideColors) {
-            const auto& paletteColorIndex = pair.first;
             const auto& color = pair.second;
-            WTF::switchOn(paletteColorIndex, [] (const AtomString&) {
-                // This is unimplementable in Core Text.
-            }, [&] (unsigned index) {
-                int64_t rawIndex = index; // There is no kCFNumberUIntType.
-                auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &rawIndex));
-                auto colorObject = cachedCGColor(color);
-                CFDictionaryAddValue(overrideDictionary.get(), number.get(), colorObject);
-            });
+            int64_t rawIndex = pair.first; // There is no kCFNumberUIntType.
+            auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &rawIndex));
+            auto colorObject = cachedCGColor(color);
+            CFDictionaryAddValue(overrideDictionary.get(), number.get(), colorObject);
         }
         if (CFDictionaryGetCount(overrideDictionary.get()))
             CFDictionaryAddValue(attributes, kCTFontPaletteColorsAttribute, overrideDictionary.get());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to