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

@ -207,6 +207,7 @@ pub enum FontStyle<Angle> {
///
/// https://www.w3.org/TR/css-fonts-4/#font-size-adjust-prop
/// https://github.com/w3c/csswg-drafts/issues/6160
/// https://github.com/w3c/csswg-drafts/issues/6288
#[allow(missing_docs)]
#[repr(u8)]
#[derive(
@ -228,14 +229,16 @@ pub enum FontStyle<Angle> {
pub enum GenericFontSizeAdjust<Number> {
#[animation(error)]
None,
// 'ex' is the implied basis, so the keyword can be omitted
Ex(Number),
// 'ex-height' is the implied basis, so the keyword can be omitted
ExHeight(Number),
#[value_info(starts_with_keyword)]
Cap(Number),
CapHeight(Number),
#[value_info(starts_with_keyword)]
Ch(Number),
ChWidth(Number),
#[value_info(starts_with_keyword)]
Ic(Number),
IcWidth(Number),
#[value_info(starts_with_keyword)]
IcHeight(Number),
}
impl<Number: ToCss> ToCss for GenericFontSizeAdjust<Number> {
@ -245,10 +248,11 @@ impl<Number: ToCss> ToCss for GenericFontSizeAdjust<Number> {
{
let (prefix, value) = match self {
Self::None => return dest.write_str("none"),
Self::Ex(v) => ("", v),
Self::Cap(v) => ("cap ", v),
Self::Ch(v) => ("ch ", v),
Self::Ic(v) => ("ic ", v),
Self::ExHeight(v) => ("", v),
Self::CapHeight(v) => ("cap-height ", v),
Self::ChWidth(v) => ("ch-width ", v),
Self::IcWidth(v) => ("ic-width ", v),
Self::IcHeight(v) => ("ic-height ", v),
};
dest.write_str(prefix)?;