mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Format remaining files
This commit is contained in:
parent
bf47f90da6
commit
cb07debcb6
252 changed files with 5944 additions and 3744 deletions
|
@ -12,11 +12,17 @@ fn cascade(
|
|||
name_and_value: &[(&str, &str)],
|
||||
inherited: Option<&Arc<CustomPropertiesMap>>,
|
||||
) -> Option<Arc<CustomPropertiesMap>> {
|
||||
let values = name_and_value.iter().map(|&(name, value)| {
|
||||
let mut input = ParserInput::new(value);
|
||||
let mut parser = Parser::new(&mut input);
|
||||
(Name::from(name), SpecifiedValue::parse(&mut parser).unwrap())
|
||||
}).collect::<Vec<_>>();
|
||||
let values = name_and_value
|
||||
.iter()
|
||||
.map(|&(name, value)| {
|
||||
let mut input = ParserInput::new(value);
|
||||
let mut parser = Parser::new(&mut input);
|
||||
(
|
||||
Name::from(name),
|
||||
SpecifiedValue::parse(&mut parser).unwrap(),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let env = CssEnvironment;
|
||||
let mut builder = CustomPropertiesBuilder::new(inherited, &env);
|
||||
|
@ -31,14 +37,11 @@ fn cascade(
|
|||
#[bench]
|
||||
fn cascade_custom_simple(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let parent = cascade(&[
|
||||
("foo", "10px"),
|
||||
("bar", "100px"),
|
||||
], None);
|
||||
let parent = cascade(&[("foo", "10px"), ("bar", "100px")], None);
|
||||
|
||||
test::black_box(cascade(&[
|
||||
("baz", "calc(40em + 4px)"),
|
||||
("bazz", "calc(30em + 4px)"),
|
||||
], parent.as_ref()))
|
||||
test::black_box(cascade(
|
||||
&[("baz", "calc(40em + 4px)"), ("bazz", "calc(30em + 4px)")],
|
||||
parent.as_ref(),
|
||||
))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue