mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Derive the most trivial ToCss implementations 🌋
For now, all variants get serialised as the space-separated serialisations of their fields. Unit variants are not supported.
This commit is contained in:
parent
6d6f03974d
commit
c4f1d647a0
18 changed files with 113 additions and 263 deletions
|
@ -481,9 +481,9 @@ pub struct Shadow {
|
|||
/// A `<number>` value.
|
||||
pub type Number = CSSFloat;
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
|
||||
pub enum NumberOrPercentage {
|
||||
Percentage(Percentage),
|
||||
Number(Number),
|
||||
|
@ -512,15 +512,6 @@ impl ToComputedValue for specified::NumberOrPercentage {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToCss for NumberOrPercentage {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
NumberOrPercentage::Percentage(percentage) => percentage.to_css(dest),
|
||||
NumberOrPercentage::Number(number) => number.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A type used for opacity.
|
||||
pub type Opacity = CSSFloat;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue