--- a/servo/components/style/properties/shorthand/box.mako.rs
+++ b/servo/components/style/properties/shorthand/box.mako.rs
@@ -169,40 +169,48 @@ macro_rules! try_parse_one {
% endfor
}
fn parse_one_animation(context: &ParserContext, input: &mut Parser) -> Result<SingleAnimation,()> {
% for prop in props:
let mut ${prop} = None;
% endfor
+ let mut parsed = 0;
// NB: Name must be the last one here so that keywords valid for other
// longhands are not interpreted as names.
//
// Also, duration must be before delay, see
// https://drafts.csswg.org/css-animations/#typedef-single-animation
loop {
+ parsed += 1;
try_parse_one!(context, input, duration, animation_duration);
try_parse_one!(context, input, timing_function, animation_timing_function);
try_parse_one!(context, input, delay, animation_delay);
try_parse_one!(context, input, iteration_count, animation_iteration_count);
try_parse_one!(input, direction, animation_direction);
try_parse_one!(input, fill_mode, animation_fill_mode);
try_parse_one!(input, play_state, animation_play_state);
try_parse_one!(context, input, name, animation_name);
+ parsed -= 1;
break
}
- Ok(SingleAnimation {
- % for prop in props:
- animation_${prop}: ${prop}.unwrap_or_else(animation_${prop}::single_value
- ::get_initial_specified_value),
- % endfor
- })
+ // If nothing is parsed, this is an invalid entry.
+ if parsed == 0 {
+ Err(())
+ } else {
+ Ok(SingleAnimation {
+ % for prop in props:
+ animation_${prop}: ${prop}.unwrap_or_else(animation_${prop}::single_value
+ ::get_initial_specified_value),
+ % endfor
+ })
+ }
}
% for prop in props:
let mut ${prop}s = vec![];
% endfor
let results = try!(input.parse_comma_separated(|i| parse_one_animation(context, i)));
for result in results.into_iter() {