Bug 1502679 - Properly handle exhaustive matches in animation keywords to avoid a warning.
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 27 Oct 2018 23:41:30 +0200
changeset 499694 3415a6d8d9357a0ba2ad6f63812b9c0a5b14e3e5
parent 499690 e11449a47b08244567e6252a662950f9d1e44edc
child 499695 3a268a8fa9e2824578a8f341c935487896288aae
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1502679
milestone65.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
Bug 1502679 - Properly handle exhaustive matches in animation keywords to avoid a warning. Need to do the gecko_inexhaustive thing because those animation properties have an EndGuard_ generated by IPDL I suspect.
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhands/box.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -2995,17 +2995,19 @@ fn static_assert() {
     #[allow(non_snake_case)]
     pub fn animation_${ident}_at(&self, index: usize)
         -> longhands::animation_${ident}::computed_value::SingleComputedValue {
         use properties::longhands::animation_${ident}::single_value::computed_value::T as Keyword;
         match self.gecko.mAnimations[index].m${gecko_ffi_name} ${keyword.maybe_cast("u32")} {
             % for value in keyword.gecko_values():
                 structs::${keyword.gecko_constant(value)} => Keyword::${to_camel_case(value)},
             % endfor
+            % if keyword.gecko_inexhaustive:
             _ => panic!("Found unexpected value for animation-${ident}"),
+            % endif
         }
     }
     ${impl_animation_count(ident, gecko_ffi_name)}
     ${impl_copy_animation_value(ident, gecko_ffi_name)}
 </%def>
 
 <%def name="impl_individual_transform(ident, type, gecko_ffi_name)">
     pub fn set_${ident}(&mut self, other: values::computed::${type}) {
--- a/servo/components/style/properties/longhands/box.mako.rs
+++ b/servo/components/style/properties/longhands/box.mako.rs
@@ -242,16 +242,17 @@
     "animation-direction",
     "normal reverse alternate alternate-reverse",
     need_index=True,
     animation_value_type="none",
     vector=True,
     gecko_enum_prefix="PlaybackDirection",
     custom_consts=animation_direction_custom_consts,
     extra_prefixes=animation_extra_prefixes,
+    gecko_inexhaustive=True,
     spec="https://drafts.csswg.org/css-animations/#propdef-animation-direction",
     allowed_in_keyframe_block=False,
 )}
 
 ${helpers.single_keyword(
     "animation-play-state",
     "running paused",
     need_index=True,
@@ -266,16 +267,17 @@
 ${helpers.single_keyword(
     "animation-fill-mode",
     "none forwards backwards both",
     need_index=True,
     animation_value_type="none",
     vector=True,
     gecko_enum_prefix="FillMode",
     extra_prefixes=animation_extra_prefixes,
+    gecko_inexhaustive=True,
     spec="https://drafts.csswg.org/css-animations/#propdef-animation-fill-mode",
     allowed_in_keyframe_block=False,
 )}
 
 ${helpers.predefined_type(
     "animation-delay",
     "Time",
     "computed::Time::zero()",