mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Macroize @font-face descriptor definitions
This commit is contained in:
parent
2b83d844da
commit
4bcae573b3
3 changed files with 89 additions and 57 deletions
|
@ -24,6 +24,21 @@ pub trait ToCss {
|
|||
}
|
||||
}
|
||||
|
||||
/// Marker trait to automatically implement ToCss for Vec<T>.
|
||||
pub trait CommaSeparated {}
|
||||
|
||||
impl<T> ToCss for Vec<T> where T: ToCss + CommaSeparated {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
let mut iter = self.iter();
|
||||
iter.next().unwrap().to_css(dest)?;
|
||||
for item in iter {
|
||||
dest.write_str(", ")?;
|
||||
item.to_css(dest)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for Au {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
write!(dest, "{}px", self.to_f64_px())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue