diff --git a/components/style/values/generics/font.rs b/components/style/values/generics/font.rs index 8fb5e5245dd..d48a0a36bbc 100644 --- a/components/style/values/generics/font.rs +++ b/components/style/values/generics/font.rs @@ -186,8 +186,9 @@ impl SpecifiedValueInfo for KeywordInfo { } /// CSS font keywords -#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, - SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToCss)] +#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, + Parse, PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, + ToCss)] #[allow(missing_docs)] pub enum KeywordSize { #[css(keyword = "xx-small")] diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs index 7f971f36fcf..fedf748d54f 100644 --- a/components/style/values/specified/font.rs +++ b/components/style/values/specified/font.rs @@ -715,21 +715,6 @@ impl KeywordInfo { } } -impl KeywordSize { - /// Parses a keyword size. - pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result> { - try_match_ident_ignore_ascii_case! { input, - "xx-small" => Ok(KeywordSize::XXSmall), - "x-small" => Ok(KeywordSize::XSmall), - "small" => Ok(KeywordSize::Small), - "medium" => Ok(KeywordSize::Medium), - "large" => Ok(KeywordSize::Large), - "x-large" => Ok(KeywordSize::XLarge), - "xx-large" => Ok(KeywordSize::XXLarge), - } - } -} - /// This is the ratio applied for font-size: larger /// and smaller by both Firefox and Chrome const LARGER_FONT_SIZE_RATIO: f32 = 1.2; diff --git a/components/style_derive/parse.rs b/components/style_derive/parse.rs index 620ba3fee82..7727d6b89bb 100644 --- a/components/style_derive/parse.rs +++ b/components/style_derive/parse.rs @@ -20,6 +20,10 @@ pub fn derive(input: DeriveInput) -> Tokens { ); let variant_attrs = cg::parse_variant_attrs_from_ast::(&variant.ast()); + if variant_attrs.skip { + return match_body; + } + let identifier = cg::to_css_identifier( &variant_attrs.keyword.unwrap_or(variant.ast().ident.as_ref().into()), );