Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-fonts] Add parsing tests for font-palette #30845

Merged
merged 1 commit into from Sep 17, 2021

Conversation

litherum
Copy link
Contributor

We're starting to implement this in WebKit.

Copy link
Contributor

@drott drott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@litherum litherum merged commit f798da1 into web-platform-tests:master Sep 17, 2021
webkit-commit-queue pushed a commit to WebKit/WebKit that referenced this pull request Sep 22, 2021
https://bugs.webkit.org/show_bug.cgi?id=230394

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

This is being upstreamed at web-platform-tests/wpt#30845.

* web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* web-platform-tests/css/css-fonts/parsing/font-palette-computed-expected.txt: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-computed.html: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-invalid-expected.txt: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-invalid.html: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-valid-expected.txt: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-valid.html: Added.
* web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
* web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:

Source/WebCore:

This is a pretty straightforward parsing patch. The grammar is just
font-palette: none | normal | light | dark | <palette-identifier>.
A <palette-identifier> is a <custom-ident>.

There is a choice to make about how to represent the parsed data:
Option 1:
class None {}; class Normal {}; class Light {}; class Dark {};
class Custom { String value; };
using FontPalette = Variant<None, Normal, Light, Dark, Custom>;

or,
Option 2:
struct FontPalette {
    enum class Type { None, Normal, Light, Dark, Custom } type;
    String value;
};

Upon advice from a trusted colleague, I chose option 2.

I'm implementing parsing support for @font-palette-values in
https://bugs.webkit.org/show_bug.cgi?id=230337.

Tests: imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-computed.html
       imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-invalid.html
       imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-valid.html

* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::fontPaletteFromStyle):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontPalette):
(WebCore::CSSPropertyParser::parseSingleValue):
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKeyRareData::create):
(WebCore::FontDescriptionKeyRareData::featureSettings const):
(WebCore::FontDescriptionKeyRareData::variationSettings const):
(WebCore::FontDescriptionKeyRareData::fontPalette const):
(WebCore::FontDescriptionKeyRareData::operator== const):
(WebCore::FontDescriptionKeyRareData::FontDescriptionKeyRareData):
(WebCore::add):
(WebCore::FontDescriptionKey::FontDescriptionKey):
(WebCore::FontDescriptionKey::operator== const):
* platform/graphics/FontCascadeDescription.cpp:
* platform/graphics/FontCascadeDescription.h:
(WebCore::FontCascadeDescription::initialFontPalette):
* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::FontDescription):
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::fontPalette const):
(WebCore::FontDescription::setFontPalette):
(WebCore::FontDescription::operator== const):
(WebCore::FontDescription::encode const):
(WebCore::FontDescription::decode):
* platform/graphics/FontPalette.h: Added.
(WebCore::FontPaletteNone::operator== const):
(WebCore::FontPaletteNone::operator!= const):
(WebCore::add):
(WebCore::FontPaletteNormal::operator== const):
(WebCore::FontPaletteNormal::operator!= const):
(WebCore::FontPaletteLight::operator== const):
(WebCore::FontPaletteLight::operator!= const):
(WebCore::FontPaletteDark::operator== const):
(WebCore::FontPaletteDark::operator!= const):
(WebCore::FontPaletteCustom::operator== const):
(WebCore::FontPaletteCustom::operator!= const):
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertFontPalette):

LayoutTests:

* platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
* platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* platform/ios/fast/css/getComputedStyle/computed-style-font-family-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-font-family-expected.txt:

Canonical link: https://commits.webkit.org/241982@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
bertogg pushed a commit to Igalia/webkit that referenced this pull request Sep 22, 2021
https://bugs.webkit.org/show_bug.cgi?id=230394

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

This is being upstreamed at web-platform-tests/wpt#30845.

* web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* web-platform-tests/css/css-fonts/parsing/font-palette-computed-expected.txt: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-computed.html: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-invalid-expected.txt: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-invalid.html: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-valid-expected.txt: Added.
* web-platform-tests/css/css-fonts/parsing/font-palette-valid.html: Added.
* web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
* web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:

Source/WebCore:

This is a pretty straightforward parsing patch. The grammar is just
font-palette: none | normal | light | dark | <palette-identifier>.
A <palette-identifier> is a <custom-ident>.

There is a choice to make about how to represent the parsed data:
Option 1:
class None {}; class Normal {}; class Light {}; class Dark {};
class Custom { String value; };
using FontPalette = Variant<None, Normal, Light, Dark, Custom>;

or,
Option 2:
struct FontPalette {
    enum class Type { None, Normal, Light, Dark, Custom } type;
    String value;
};

Upon advice from a trusted colleague, I chose option 2.

I'm implementing parsing support for @font-palette-values in
https://bugs.webkit.org/show_bug.cgi?id=230337.

Tests: imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-computed.html
       imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-invalid.html
       imported/w3c/web-platform-tests/css/css-fonts/parsing/font-palette-valid.html

* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::fontPaletteFromStyle):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontPalette):
(WebCore::CSSPropertyParser::parseSingleValue):
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKeyRareData::create):
(WebCore::FontDescriptionKeyRareData::featureSettings const):
(WebCore::FontDescriptionKeyRareData::variationSettings const):
(WebCore::FontDescriptionKeyRareData::fontPalette const):
(WebCore::FontDescriptionKeyRareData::operator== const):
(WebCore::FontDescriptionKeyRareData::FontDescriptionKeyRareData):
(WebCore::add):
(WebCore::FontDescriptionKey::FontDescriptionKey):
(WebCore::FontDescriptionKey::operator== const):
* platform/graphics/FontCascadeDescription.cpp:
* platform/graphics/FontCascadeDescription.h:
(WebCore::FontCascadeDescription::initialFontPalette):
* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::FontDescription):
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::fontPalette const):
(WebCore::FontDescription::setFontPalette):
(WebCore::FontDescription::operator== const):
(WebCore::FontDescription::encode const):
(WebCore::FontDescription::decode):
* platform/graphics/FontPalette.h: Added.
(WebCore::FontPaletteNone::operator== const):
(WebCore::FontPaletteNone::operator!= const):
(WebCore::add):
(WebCore::FontPaletteNormal::operator== const):
(WebCore::FontPaletteNormal::operator!= const):
(WebCore::FontPaletteLight::operator== const):
(WebCore::FontPaletteLight::operator!= const):
(WebCore::FontPaletteDark::operator== const):
(WebCore::FontPaletteDark::operator!= const):
(WebCore::FontPaletteCustom::operator== const):
(WebCore::FontPaletteCustom::operator!= const):
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertFontPalette):

LayoutTests:

* platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
* platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* platform/ios/fast/css/getComputedStyle/computed-style-font-family-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-font-family-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@282851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Gabisampaio pushed a commit to Gabisampaio/wpt that referenced this pull request Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants