author | Xidorn Quan <me@upsuper.org> |
Sun, 29 Apr 2018 09:03:31 +1000 | |
changeset 416179 | 3575c9c5228555b4e57d448220796d4ab383febc |
parent 416178 | 30d22ed91462076e8fbcfe78e631567164afda96 |
child 416180 | 1fc2da3cfe61153253ff19a6362cd89057f82a92 |
push id | 33918 |
push user | nerli@mozilla.com |
push date | Sun, 29 Apr 2018 09:47:13 +0000 |
treeherder | mozilla-central@afbec7f03bd8 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | emilio |
bugs | 1434130 |
milestone | 61.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/servo/components/style/values/generics/font.rs +++ b/servo/components/style/values/generics/font.rs @@ -181,18 +181,19 @@ where } } impl<Length> SpecifiedValueInfo for KeywordInfo<Length> { const SUPPORTED_TYPES: u8 = <KeywordSize as SpecifiedValueInfo>::SUPPORTED_TYPES; } /// 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")] XXSmall, XSmall, Small, Medium, Large,
--- a/servo/components/style/values/specified/font.rs +++ b/servo/components/style/values/specified/font.rs @@ -712,31 +712,16 @@ impl KeywordInfo { KeywordInfo { kw: self.kw, factor: self.factor * factor, offset: self.offset.scale_by(factor) + offset, } } } -impl KeywordSize { - /// Parses a keyword size. - pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> { - 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; /// The default font size. pub const FONT_MEDIUM_PX: i32 = 16; #[cfg(feature = "servo")]
--- a/servo/components/style_derive/parse.rs +++ b/servo/components/style_derive/parse.rs @@ -15,16 +15,20 @@ pub fn derive(input: DeriveInput) -> Tok let match_body = s.variants().iter().fold(quote!(), |match_body, variant| { let bindings = variant.bindings(); assert!( bindings.is_empty(), "Parse is only supported for single-variant enums for now" ); let variant_attrs = cg::parse_variant_attrs_from_ast::<CssVariantAttrs>(&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()), ); let ident = &variant.ast().ident; let mut body = quote! { #match_body #identifier => Ok(#name::#ident),