From 8f367be650705b2febb31bcf6131aab9ddec0850 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 24 May 2018 14:12:55 +1000 Subject: [PATCH] style: Don't generate catch-all branch if a image layer keyword value is exhaustive. Bug: 1463978 Reviewed-by: emilio MozReview-Commit-ID: H8T9Low6kqY --- components/style/properties/gecko.mako.rs | 2 + .../properties/longhand/background.mako.rs | 36 +++++++++------- .../style/properties/longhand/svg.mako.rs | 43 +++++++++++-------- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 1fc486975fd..4d14405318e 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -3805,7 +3805,9 @@ fn static_assert() { % endif => Keyword::${to_camel_case(value)}, % endfor + % if keyword.gecko_inexhaustive: _ => panic!("Found unexpected value in style struct for ${ident} property"), + % endif } }).collect() ) diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index 3366376466a..9bb4e03e523 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -60,22 +60,28 @@ ${helpers.single_keyword("background-attachment", animation_value_type="discrete", flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")} -${helpers.single_keyword("background-clip", - "border-box padding-box content-box", - extra_gecko_values="text", - vector=True, extra_prefixes="webkit", - gecko_enum_prefix="StyleGeometryBox", - spec="https://drafts.csswg.org/css-backgrounds/#the-background-clip", - animation_value_type="discrete", - flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")} +${helpers.single_keyword( + "background-clip", + "border-box padding-box content-box", + extra_gecko_values="text", + vector=True, extra_prefixes="webkit", + gecko_enum_prefix="StyleGeometryBox", + gecko_inexhaustive=True, + spec="https://drafts.csswg.org/css-backgrounds/#the-background-clip", + animation_value_type="discrete", + flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", +)} -${helpers.single_keyword("background-origin", - "padding-box border-box content-box", - vector=True, extra_prefixes="webkit", - gecko_enum_prefix="StyleGeometryBox", - spec="https://drafts.csswg.org/css-backgrounds/#the-background-origin", - animation_value_type="discrete", - flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")} +${helpers.single_keyword( + "background-origin", + "padding-box border-box content-box", + vector=True, extra_prefixes="webkit", + gecko_enum_prefix="StyleGeometryBox", + gecko_inexhaustive=True, + spec="https://drafts.csswg.org/css-backgrounds/#the-background-origin", + animation_value_type="discrete", + flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER" +)} ${helpers.predefined_type( "background-size", diff --git a/components/style/properties/longhand/svg.mako.rs b/components/style/properties/longhand/svg.mako.rs index 3236495fc26..2ec7bcc59a1 100644 --- a/components/style/properties/longhand/svg.mako.rs +++ b/components/style/properties/longhand/svg.mako.rs @@ -108,25 +108,32 @@ ${helpers.predefined_type( )} % endfor -${helpers.single_keyword("mask-clip", - "border-box content-box padding-box", - extra_gecko_values="fill-box stroke-box view-box no-clip", - vector=True, - products="gecko", - extra_prefixes="webkit", - gecko_enum_prefix="StyleGeometryBox", - animation_value_type="discrete", - spec="https://drafts.fxtf.org/css-masking/#propdef-mask-clip")} +${helpers.single_keyword( + "mask-clip", + "border-box content-box padding-box", + extra_gecko_values="fill-box stroke-box view-box no-clip", + vector=True, + products="gecko", + extra_prefixes="webkit", + gecko_enum_prefix="StyleGeometryBox", + gecko_inexhaustive=True, + animation_value_type="discrete", + spec="https://drafts.fxtf.org/css-masking/#propdef-mask-clip", +)} + +${helpers.single_keyword( + "mask-origin", + "border-box content-box padding-box", + extra_gecko_values="fill-box stroke-box view-box", + vector=True, + products="gecko", + extra_prefixes="webkit", + gecko_enum_prefix="StyleGeometryBox", + gecko_inexhaustive=True, + animation_value_type="discrete", + spec="https://drafts.fxtf.org/css-masking/#propdef-mask-origin", +)} -${helpers.single_keyword("mask-origin", - "border-box content-box padding-box", - extra_gecko_values="fill-box stroke-box view-box", - vector=True, - products="gecko", - extra_prefixes="webkit", - gecko_enum_prefix="StyleGeometryBox", - animation_value_type="discrete", - spec="https://drafts.fxtf.org/css-masking/#propdef-mask-origin")} ${helpers.predefined_type( "mask-size", "background::BackgroundSize",