Bug 1463978 - Don't generate catch-all branch if a image layer keyword value is exhaustive. r?heycam
MozReview-Commit-ID: H8T9Low6kqY
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -3800,17 +3800,19 @@ fn static_assert() {
% for value in longhand.keyword.values_for("gecko"):
% if keyword.needs_cast():
${keyword.casted_constant_name(value, "u8")}
% else:
structs::${keyword.gecko_constant(value)}
% endif
=> Keyword::${to_camel_case(value)},
% endfor
+ % if keyword.gecko_inexhaustive:
_ => panic!("Found unexpected value in style struct for ${ident} property"),
+ % endif
}
}).collect()
)
}
</%def>
<%def name="impl_common_image_layer_properties(shorthand)">
<%
--- a/servo/components/style/properties/longhand/background.mako.rs
+++ b/servo/components/style/properties/longhand/background.mako.rs
@@ -55,32 +55,38 @@
${helpers.single_keyword("background-attachment",
"scroll fixed" + (" local" if product == "gecko" else ""),
vector=True,
gecko_enum_prefix="StyleImageLayerAttachment",
spec="https://drafts.csswg.org/css-backgrounds/#the-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",
"BackgroundSize",
initial_value="computed::BackgroundSize::auto()",
initial_specified_value="specified::BackgroundSize::auto()",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-size",
vector=True,
--- a/servo/components/style/properties/longhand/svg.mako.rs
+++ b/servo/components/style/properties/longhand/svg.mako.rs
@@ -103,35 +103,42 @@
initial_specified_value="specified::PositionComponent::Center",
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position",
animation_value_type="ComputedValue",
vector_animation_type="repeatable_list",
vector=True,
)}
% 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",
- 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",
+ gecko_inexhaustive=True,
+ animation_value_type="discrete",
+ spec="https://drafts.fxtf.org/css-masking/#propdef-mask-origin",
+)}
+
${helpers.predefined_type(
"mask-size",
"background::BackgroundSize",
"computed::BackgroundSize::auto()",
initial_specified_value="specified::BackgroundSize::auto()",
products="gecko",
extra_prefixes="webkit",
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-size",