Keep custom-ident and string separate in animation/keyframes name.

This commit is contained in:
Simon Sapin 2017-04-25 09:14:32 +02:00
parent 82c04113d0
commit 1146921866
13 changed files with 123 additions and 67 deletions

View file

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

View file

@ -7,7 +7,7 @@ use servo_atoms::Atom;
use style::parser::Parse;
use style::properties::longhands::animation_iteration_count::single_value::computed_value::T as AnimationIterationCount;
use style::properties::longhands::animation_name;
use style::values::CustomIdent;
use style::values::{KeyframesName, CustomIdent};
use style_traits::ToCss;
#[test]
@ -15,13 +15,13 @@ 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(CustomIdent(atom!("")))]));
animation_name::SpecifiedValue(vec![SingleValue(None)]));
assert_eq!(parse_longhand!(animation_name, "other-name, none, 'other-name', \"other-name\""),
animation_name::SpecifiedValue(
vec![SingleValue(CustomIdent(other_name.clone())),
SingleValue(CustomIdent(atom!(""))),
SingleValue(CustomIdent(other_name.clone())),
SingleValue(CustomIdent(other_name.clone()))]));
vec![SingleValue(Some(KeyframesName::Ident(CustomIdent(other_name.clone())))),
SingleValue(None),
SingleValue(Some(KeyframesName::QuotedString(other_name.clone()))),
SingleValue(Some(KeyframesName::QuotedString(other_name.clone())))]));
}
#[test]

View file

@ -23,7 +23,7 @@ use style::properties::longhands::animation_play_state;
use style::shared_lock::SharedRwLock;
use style::stylesheets::{Origin, Namespaces};
use style::stylesheets::{Stylesheet, NamespaceRule, CssRule, CssRules, StyleRule, KeyframesRule};
use style::values::CustomIdent;
use style::values::{KeyframesName, CustomIdent};
use style::values::specified::{LengthOrPercentageOrAuto, Percentage};
pub fn block_from<I>(iterable: I) -> PropertyDeclarationBlock
@ -222,7 +222,7 @@ fn test_parse_stylesheet() {
]))),
}))),
CssRule::Keyframes(Arc::new(stylesheet.shared_lock.wrap(KeyframesRule {
name: CustomIdent("foo".into()),
name: KeyframesName::Ident(CustomIdent("foo".into())),
keyframes: vec![
Arc::new(stylesheet.shared_lock.wrap(Keyframe {
selector: KeyframeSelector::new_for_unit_testing(