Unreverse declarations in memory.

This commit is contained in:
Simon Sapin 2016-08-18 17:16:51 +02:00
parent 31864954ed
commit 477cae67df
4 changed files with 29 additions and 25 deletions

View file

@ -39,8 +39,6 @@ fn property_declaration_block_should_serialize_correctly() {
let height = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(20f32)));
important.push(PropertyDeclaration::Height(height));
normal.reverse();
important.reverse();
let block = PropertyDeclarationBlock {
normal: Arc::new(normal),
important: Arc::new(important)

View file

@ -39,6 +39,16 @@ fn test_parse_stylesheet() {
let stylesheet = Stylesheet::from_str(css, url, Origin::UserAgent,
Box::new(CSSErrorReporterTest),
ParserContextExtraData::default());
macro_rules! assert_eq {
($left: expr, $right: expr) => {
let left = $left;
let right = $right;
if left != right {
panic!("{:#?} != {:#?}", left, right)
}
}
}
assert_eq!(stylesheet, Stylesheet {
origin: Origin::UserAgent,
media: None,
@ -157,13 +167,6 @@ fn test_parse_stylesheet() {
],
declarations: PropertyDeclarationBlock {
normal: Arc::new(vec![
PropertyDeclaration::BackgroundClip(DeclaredValue::Initial),
PropertyDeclaration::BackgroundOrigin(DeclaredValue::Initial),
PropertyDeclaration::BackgroundSize(DeclaredValue::Initial),
PropertyDeclaration::BackgroundImage(DeclaredValue::Initial),
PropertyDeclaration::BackgroundAttachment(DeclaredValue::Initial),
PropertyDeclaration::BackgroundRepeat(DeclaredValue::Initial),
PropertyDeclaration::BackgroundPosition(DeclaredValue::Initial),
PropertyDeclaration::BackgroundColor(DeclaredValue::Value(
longhands::background_color::SpecifiedValue {
authored: Some("blue".to_owned()),
@ -172,6 +175,13 @@ fn test_parse_stylesheet() {
}),
}
)),
PropertyDeclaration::BackgroundPosition(DeclaredValue::Initial),
PropertyDeclaration::BackgroundRepeat(DeclaredValue::Initial),
PropertyDeclaration::BackgroundAttachment(DeclaredValue::Initial),
PropertyDeclaration::BackgroundImage(DeclaredValue::Initial),
PropertyDeclaration::BackgroundSize(DeclaredValue::Initial),
PropertyDeclaration::BackgroundOrigin(DeclaredValue::Initial),
PropertyDeclaration::BackgroundClip(DeclaredValue::Initial),
]),
important: Arc::new(vec![]),
},