Bug 1426312: Make sure to honor parse_method in transition and animation shorthands. r?birtles
MozReview-Commit-ID: HY3jtdSdaga
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/1426312.html
@@ -0,0 +1,4 @@
+<style>
+ @keyframes a { }
+ * { animation: a -7s }
+</style>
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -261,8 +261,9 @@ load 1411478.html
load 1413288.html
load 1413361.html
load 1415663.html
pref(dom.webcomponents.enabled,true) load 1415353.html
load 1415021.html # This should have dom.webcomponents.enabled=true, but it leaks the world, see bug 1416296.
load 1418059.html
skip-if(!stylo) test-pref(dom.animations-api.core.enabled,true) load 1418867.html
pref(dom.webcomponents.enabled,true) load 1419554.html
+load 1426312.html
--- a/servo/components/style/properties/shorthand/box.mako.rs
+++ b/servo/components/style/properties/shorthand/box.mako.rs
@@ -92,42 +92,33 @@
}
Ok(())
}
}
</%helpers:shorthand>
macro_rules! try_parse_one {
- ($input: expr, $var: ident, $prop_module: ident) => {
- if $var.is_none() {
- if let Ok(value) = $input.try($prop_module::SingleSpecifiedValue::parse) {
- $var = Some(value);
- continue;
- }
- }
- };
($context: expr, $input: expr, $var: ident, $prop_module: ident) => {
if $var.is_none() {
if let Ok(value) = $input.try(|i| {
- $prop_module::SingleSpecifiedValue::parse($context, i)
+ $prop_module::single_value::parse($context, i)
}) {
$var = Some(value);
continue;
}
}
};
}
<%helpers:shorthand name="transition" extra_prefixes="moz webkit"
sub_properties="transition-property transition-duration
transition-timing-function
transition-delay"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition">
- use parser::Parse;
% for prop in "delay duration property timing_function".split():
use properties::longhands::transition_${prop};
% endfor
pub fn parse_value<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<Longhands, ParseError<'i>> {
struct SingleTransition {
% for prop in "duration timing_function delay".split():
@@ -260,17 +251,16 @@ macro_rules! try_parse_one {
animation-iteration-count animation-direction
animation-fill-mode animation-play-state"
allowed_in_keyframe_block="False"
spec="https://drafts.csswg.org/css-animations/#propdef-animation">
<%
props = "name duration timing_function delay iteration_count \
direction fill_mode play_state".split()
%>
- use parser::Parse;
% for prop in props:
use properties::longhands::animation_${prop};
% endfor
pub fn parse_value<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<Longhands, ParseError<'i>> {
struct SingleAnimation {
% for prop in props:
@@ -291,19 +281,19 @@ macro_rules! try_parse_one {
// 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, direction, animation_direction);
+ try_parse_one!(context, input, fill_mode, animation_fill_mode);
+ try_parse_one!(context, input, play_state, animation_play_state);
try_parse_one!(context, input, name, animation_name);
parsed -= 1;
break
}
// If nothing is parsed, this is an invalid entry.
if parsed == 0 {