Changeset 283756 in webkit


Ignore:
Timestamp:
Oct 7, 2021 4:37:01 PM (10 months ago)
Author:
mmaxfield@apple.com
Message:

Shadowing of @font-palette-values rules doesn't work
https://bugs.webkit.org/show_bug.cgi?id=231218
<rdar://problem/83872258>

Reviewed by Wenson Hsieh.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-fonts/font-palette-32-expected.html: Added.
  • web-platform-tests/css/css-fonts/font-palette-32.html: Added.

Source/WebCore:

https://drafts.csswg.org/css-fonts-4/#font-palette-values says:

When a given descriptor occurs multiple times in a given @font-palette-values rule,
only the last descriptor declaration is used.

Test: imported/w3c/web-platform-tests/css/css-fonts/font-palette-32.html

  • css/CSSFontSelector.cpp:

(WebCore::CSSFontSelector::buildStarted):
(WebCore::CSSFontSelector::addFontPaletteValuesRule):
(WebCore::CSSFontSelector::lookupFontPaletteValues):

  • css/CSSFontSelector.h:
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r283752 r283756  
     12021-10-07  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Shadowing of @font-palette-values rules doesn't work
     4        https://bugs.webkit.org/show_bug.cgi?id=231218
     5        <rdar://problem/83872258>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        * web-platform-tests/css/css-fonts/font-palette-32-expected.html: Added.
     10        * web-platform-tests/css/css-fonts/font-palette-32.html: Added.
     11
    1122021-10-07  Myles C. Maxfield  <mmaxfield@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r283755 r283756  
     12021-10-07  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Shadowing of @font-palette-values rules doesn't work
     4        https://bugs.webkit.org/show_bug.cgi?id=231218
     5        <rdar://problem/83872258>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        https://drafts.csswg.org/css-fonts-4/#font-palette-values says:
     10        > When a given descriptor occurs multiple times in a given @font-palette-values rule,
     11        > only the last descriptor declaration is used.
     12
     13        Test: imported/w3c/web-platform-tests/css/css-fonts/font-palette-32.html
     14
     15        * css/CSSFontSelector.cpp:
     16        (WebCore::CSSFontSelector::buildStarted):
     17        (WebCore::CSSFontSelector::addFontPaletteValuesRule):
     18        (WebCore::CSSFontSelector::lookupFontPaletteValues):
     19        * css/CSSFontSelector.h:
     20
    1212021-10-07  Alan Bujtas  <zalan@apple.com>
    222
  • trunk/Source/WebCore/css/CSSFontSelector.cpp

    r283049 r283756  
    137137    }
    138138
    139     m_paletteFamilyMap.clear();
     139    m_paletteMap.clear();
    140140}
    141141
     
    236236    AtomString fontFamily = fontPaletteValuesRule.fontFamily().isNull() ? emptyAtom() : fontPaletteValuesRule.fontFamily();
    237237    AtomString name = fontPaletteValuesRule.name().isNull() ? emptyAtom() : fontPaletteValuesRule.name();
    238     m_paletteFamilyMap.ensure(std::make_pair(fontFamily, name), [&] () {
    239         return fontPaletteValuesRule.fontPaletteValues();
    240     });
     238    m_paletteMap.set(std::make_pair(fontFamily, name), fontPaletteValuesRule.fontPaletteValues());
    241239
    242240    ++m_version;
     
    326324    const AtomString paletteName = fontDescription.fontPalette().identifier;
    327325
    328     auto iterator = m_paletteFamilyMap.find(std::make_pair(familyName, paletteName));
    329     if (iterator == m_paletteFamilyMap.end())
     326    auto iterator = m_paletteMap.find(std::make_pair(familyName, paletteName));
     327    if (iterator == m_paletteMap.end())
    330328        return emptyFontPaletteValues.get();
    331329    return iterator->value;
  • trunk/Source/WebCore/css/CSSFontSelector.h

    r282922 r283756  
    129129    HashSet<FontSelectorClient*> m_clients;
    130130
    131     HashMap<std::pair<AtomString, AtomString>, FontPaletteValues> m_paletteFamilyMap;
     131    HashMap<std::pair<AtomString, AtomString>, FontPaletteValues> m_paletteMap;
    132132
    133133    HashSet<RefPtr<CSSFontFace>> m_cssConnectionsPossiblyToRemove;
Note: See TracChangeset for help on using the changeset viewer.