mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Fix single_value_to_css
This commit is contained in:
parent
1fff47586f
commit
c387eff065
2 changed files with 9 additions and 12 deletions
|
@ -214,16 +214,13 @@ impl PropertyDeclarationBlock {
|
||||||
if !self.declarations.iter().all(|decl| decl.0.shorthands().contains(&shorthand)) {
|
if !self.declarations.iter().all(|decl| decl.0.shorthands().contains(&shorthand)) {
|
||||||
return Err(fmt::Error)
|
return Err(fmt::Error)
|
||||||
}
|
}
|
||||||
let success = try!(shorthand.serialize_shorthand_to_buffer(
|
let iter = self.declarations.iter().map(get_declaration as fn(_) -> _);
|
||||||
dest,
|
match shorthand.get_shorthand_appendable_value(iter) {
|
||||||
self.declarations.iter()
|
Some(AppendableValue::Css(css)) => dest.write_str(css),
|
||||||
.map(get_declaration as fn(_) -> _),
|
Some(AppendableValue::DeclarationsForShorthand(_, decls)) => {
|
||||||
&mut true)
|
shorthand.longhands_to_css(decls, dest)
|
||||||
);
|
}
|
||||||
if success {
|
_ => Ok(())
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err(fmt::Error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1030,7 +1030,7 @@ mod shorthand_serialization {
|
||||||
let x = block.single_value_to_css("scroll-snap-type", &mut s);
|
let x = block.single_value_to_css("scroll-snap-type", &mut s);
|
||||||
|
|
||||||
assert_eq!(x.is_ok(), true);
|
assert_eq!(x.is_ok(), true);
|
||||||
assert_eq!(s, "scroll-snap-type: ;");
|
assert_eq!(s, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1052,7 +1052,7 @@ mod shorthand_serialization {
|
||||||
let x = block.single_value_to_css("scroll-snap-type", &mut s);
|
let x = block.single_value_to_css("scroll-snap-type", &mut s);
|
||||||
|
|
||||||
assert_eq!(x.is_ok(), true);
|
assert_eq!(x.is_ok(), true);
|
||||||
assert_eq!(s, "scroll-snap-type: mandatory;");
|
assert_eq!(s, "mandatory");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue