mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Implement serialization for transform functions.
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes #15194
This commit is contained in:
parent
e2671459cb
commit
480f59c880
8 changed files with 459 additions and 315 deletions
|
@ -25,6 +25,12 @@ pub trait ToCss {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, T> ToCss for &'a T where T: ToCss + ?Sized {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
(*self).to_css(dest)
|
||||
}
|
||||
}
|
||||
|
||||
/// Marker trait to automatically implement ToCss for Vec<T>.
|
||||
pub trait OneOrMoreCommaSeparated {}
|
||||
|
||||
|
@ -177,3 +183,14 @@ pub mod specified {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Wrap CSS types for serialization with `write!` or `format!` macros.
|
||||
/// Used by ToCss of SpecifiedOperation.
|
||||
pub struct Css<T>(pub T);
|
||||
|
||||
impl<T: ToCss> fmt::Display for Css<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.0.to_css(f)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue