style: Implement CSS parsing for the @font-palette-values rule

Not yet hooked up to any rendering functionality.

The intention is for both the @font-palette-values at-rule and the font-palette property
to be behind the same pref being introduced here.

Differential Revision: https://phabricator.services.mozilla.com/D157953
This commit is contained in:
Jonathan Kew 2022-10-07 23:00:43 +00:00 committed by Martin Robinson
parent ab4580e112
commit a4ad5e19b0
12 changed files with 353 additions and 30 deletions

View file

@ -26,6 +26,8 @@ pub enum ContextualParseError<'a> {
UnsupportedFontFaceDescriptor(&'a str, ParseError<'a>),
/// A font feature values descriptor was not recognized.
UnsupportedFontFeatureValuesDescriptor(&'a str, ParseError<'a>),
/// A font palette values descriptor was not recognized.
UnsupportedFontPaletteValuesDescriptor(&'a str, ParseError<'a>),
/// A keyframe rule was not valid.
InvalidKeyframeRule(&'a str, ParseError<'a>),
/// A font feature values rule was not valid.
@ -149,6 +151,14 @@ impl<'a> fmt::Display for ContextualParseError<'a> {
)?;
parse_error_to_str(err, f)
},
ContextualParseError::UnsupportedFontPaletteValuesDescriptor(decl, ref err) => {
write!(
f,
"Unsupported @font-palette-values descriptor declaration: '{}', ",
decl
)?;
parse_error_to_str(err, f)
},
ContextualParseError::InvalidKeyframeRule(rule, ref err) => {
write!(f, "Invalid keyframe rule: '{}', ", rule)?;
parse_error_to_str(err, f)