Auto merge of #15793 - upsuper:animation, r=emilio,bholley

Fix animation shorthand parsing

which is somehow broken after #15779.

But it seems there are various issue around the animation shorthand parsing, so I try to fix it to make it match the spec.

I expect this change to fix most parsing failures in Gecko's test suite, although I haven't tested.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15793)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-03-03 03:28:21 -08:00 committed by GitHub
commit 7cd4c69c40
7 changed files with 99 additions and 97 deletions

View file

@ -14,7 +14,7 @@ extern crate parking_lot;
extern crate rayon;
extern crate rustc_serialize;
extern crate selectors;
extern crate servo_atoms;
#[macro_use] extern crate servo_atoms;
extern crate servo_config;
extern crate servo_url;
extern crate style;

View file

@ -5,11 +5,27 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use parsing::parse;
use servo_atoms::Atom;
use style::parser::{Parse, ParserContext};
use style::properties::longhands::animation_iteration_count::single_value::computed_value::T as AnimationIterationCount;
use style::properties::longhands::animation_name;
use style::stylesheets::Origin;
use style_traits::ToCss;
#[test]
fn test_animation_name() {
use self::animation_name::single_value::SpecifiedValue as SingleValue;
let other_name = Atom::from("other-name");
assert_eq!(parse_longhand!(animation_name, "none"),
animation_name::SpecifiedValue(vec![SingleValue(atom!(""))]));
assert_eq!(parse_longhand!(animation_name, "other-name, none, 'other-name', \"other-name\""),
animation_name::SpecifiedValue(
vec![SingleValue(other_name.clone()),
SingleValue(atom!("")),
SingleValue(other_name.clone()),
SingleValue(other_name.clone())]));
}
#[test]
fn test_animation_iteration() {
assert_roundtrip_with_context!(AnimationIterationCount::parse, "0", "0");

View file

@ -983,7 +983,7 @@ mod shorthand_serialization {
let serialization = block.to_css_string();
assert_eq!(serialization, "animation: 1s ease-in 0s normal forwards infinite paused bounce;")
assert_eq!(serialization, "animation: 1s ease-in 0s infinite normal forwards paused bounce;")
}
#[test]
@ -1001,8 +1001,8 @@ mod shorthand_serialization {
let serialization = block.to_css_string();
assert_eq!(serialization,
"animation: 1s ease-in 0s normal forwards infinite paused bounce, \
0.2s linear 1s reverse backwards 2 running roll;");
"animation: 1s ease-in 0s infinite normal forwards paused bounce, \
0.2s linear 1s 2 reverse backwards running roll;");
}
#[test]