mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Clean up serialization code a little
This commit is contained in:
parent
af4d2e910e
commit
64dc95436d
1 changed files with 3 additions and 12 deletions
|
@ -623,7 +623,7 @@ pub mod specified {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! serialize {
|
macro_rules! serialize {
|
||||||
( $( [$val:ident; $name:expr] ),* ) => {
|
( $( $val:ident ),* ) => {
|
||||||
{
|
{
|
||||||
let mut first_value = true;
|
let mut first_value = true;
|
||||||
$(
|
$(
|
||||||
|
@ -633,7 +633,7 @@ pub mod specified {
|
||||||
} else {
|
} else {
|
||||||
first_value = false;
|
first_value = false;
|
||||||
}
|
}
|
||||||
try!(write!(dest, "{:?}{}", val, $name));
|
try!(val.to_css(dest));
|
||||||
}
|
}
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
|
@ -647,16 +647,7 @@ pub mod specified {
|
||||||
try!(write!(dest, "calc("));
|
try!(write!(dest, "calc("));
|
||||||
}
|
}
|
||||||
|
|
||||||
serialize!(
|
serialize!(em, ex, absolute, rem, vh, vmax, vmin, vw, percentage);
|
||||||
[em; "em"],
|
|
||||||
[ex; "ex"],
|
|
||||||
[absolute; "px"],
|
|
||||||
[rem; "rem"],
|
|
||||||
[vh; "vh"],
|
|
||||||
[vmax; "vmax"],
|
|
||||||
[vmin; "vmin"],
|
|
||||||
[vw; "vw"],
|
|
||||||
[percentage; "%"]);
|
|
||||||
|
|
||||||
if count > 1 {
|
if count > 1 {
|
||||||
try!(write!(dest, ")"));
|
try!(write!(dest, ")"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue