mirror of
https://github.com/servo/servo.git
synced 2025-07-09 08:23:38 +01:00
Treat empty animation entry invalid
This commit is contained in:
parent
97f2ccacbb
commit
cd22bcd506
1 changed files with 14 additions and 6 deletions
|
@ -174,12 +174,14 @@ macro_rules! try_parse_one {
|
||||||
let mut ${prop} = None;
|
let mut ${prop} = None;
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
|
let mut parsed = 0;
|
||||||
// NB: Name must be the last one here so that keywords valid for other
|
// NB: Name must be the last one here so that keywords valid for other
|
||||||
// longhands are not interpreted as names.
|
// longhands are not interpreted as names.
|
||||||
//
|
//
|
||||||
// Also, duration must be before delay, see
|
// Also, duration must be before delay, see
|
||||||
// https://drafts.csswg.org/css-animations/#typedef-single-animation
|
// https://drafts.csswg.org/css-animations/#typedef-single-animation
|
||||||
loop {
|
loop {
|
||||||
|
parsed += 1;
|
||||||
try_parse_one!(context, input, duration, animation_duration);
|
try_parse_one!(context, input, duration, animation_duration);
|
||||||
try_parse_one!(context, input, timing_function, animation_timing_function);
|
try_parse_one!(context, input, timing_function, animation_timing_function);
|
||||||
try_parse_one!(context, input, delay, animation_delay);
|
try_parse_one!(context, input, delay, animation_delay);
|
||||||
|
@ -189,15 +191,21 @@ macro_rules! try_parse_one {
|
||||||
try_parse_one!(input, play_state, animation_play_state);
|
try_parse_one!(input, play_state, animation_play_state);
|
||||||
try_parse_one!(context, input, name, animation_name);
|
try_parse_one!(context, input, name, animation_name);
|
||||||
|
|
||||||
|
parsed -= 1;
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(SingleAnimation {
|
// If nothing is parsed, this is an invalid entry.
|
||||||
% for prop in props:
|
if parsed == 0 {
|
||||||
animation_${prop}: ${prop}.unwrap_or_else(animation_${prop}::single_value
|
Err(())
|
||||||
::get_initial_specified_value),
|
} else {
|
||||||
% endfor
|
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:
|
% for prop in props:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue