diff --git a/components/style/values/generics/font.rs b/components/style/values/generics/font.rs index 02f91068d38..a88df7be173 100644 --- a/components/style/values/generics/font.rs +++ b/components/style/values/generics/font.rs @@ -207,6 +207,7 @@ pub enum FontStyle { /// /// 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 { pub enum GenericFontSizeAdjust { #[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 ToCss for GenericFontSizeAdjust { @@ -245,10 +248,11 @@ impl ToCss for GenericFontSizeAdjust { { 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)?; diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs index 385ed8da53c..9b417a410c6 100644 --- a/components/style/values/specified/font.rs +++ b/components/style/values/specified/font.rs @@ -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))) } }