style: Update font-size-adjust keywords to match CSSWG resolution in csswg-drafts/#6288

Differential Revision: https://phabricator.services.mozilla.com/D118198
This commit is contained in:
Jonathan Kew 2023-05-22 10:01:51 +02:00 committed by Oriol Brufau
parent 25edb3c21b
commit 695ff236c8
2 changed files with 20 additions and 15 deletions

View file

@ -794,10 +794,11 @@ impl Parse for FontSizeAdjust {
let basis = match_ignore_ascii_case! { &ident,
"none" => return Ok(FontSizeAdjust::none()),
// Check for size adjustment basis keywords if enabled.
"ex" if basis_enabled => GenericFontSizeAdjust::Ex,
"cap" if basis_enabled => GenericFontSizeAdjust::Cap,
"ch" if basis_enabled => GenericFontSizeAdjust::Ch,
"ic" if basis_enabled => GenericFontSizeAdjust::Ic,
"ex-height" if basis_enabled => GenericFontSizeAdjust::ExHeight,
"cap-height" if basis_enabled => GenericFontSizeAdjust::CapHeight,
"ch-width" if basis_enabled => GenericFontSizeAdjust::ChWidth,
"ic-width" if basis_enabled => GenericFontSizeAdjust::IcWidth,
"ic-height" if basis_enabled => GenericFontSizeAdjust::IcHeight,
// Unknown (or disabled) keyword.
_ => return Err(location.new_custom_error(
::selectors::parser::SelectorParseErrorKind::UnexpectedIdent(ident)
@ -806,9 +807,9 @@ impl Parse for FontSizeAdjust {
let value = NonNegativeNumber::parse(context, input)?;
return Ok(FontSizeAdjust::Value(basis(value)));
}
// Without a basis keyword, the number refers to the 'ex' metric.
// Without a basis keyword, the number refers to the 'ex-height' metric.
let value = NonNegativeNumber::parse(context, input)?;
Ok(FontSizeAdjust::Value(GenericFontSizeAdjust::Ex(value)))
Ok(FontSizeAdjust::Value(GenericFontSizeAdjust::ExHeight(value)))
}
}