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
|
@ -623,9 +623,9 @@ pub type LengthOrNormal = Either<Length, Normal>;
|
|||
|
||||
/// A value suitable for a `min-width`, `min-height`, `width` or `height` property.
|
||||
/// See specified/values/length.rs for more details.
|
||||
#[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 MozLength {
|
||||
LengthOrPercentageOrAuto(LengthOrPercentageOrAuto),
|
||||
ExtremumLength(ExtremumLength),
|
||||
|
@ -665,22 +665,11 @@ impl ToComputedValue for specified::MozLength {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToCss for MozLength {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
MozLength::LengthOrPercentageOrAuto(lopoa) =>
|
||||
lopoa.to_css(dest),
|
||||
MozLength::ExtremumLength(ext) =>
|
||||
ext.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A value suitable for a `max-width` or `max-height` property.
|
||||
/// See specified/values/length.rs for more details.
|
||||
#[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 MaxLength {
|
||||
LengthOrPercentageOrNone(LengthOrPercentageOrNone),
|
||||
ExtremumLength(ExtremumLength),
|
||||
|
@ -718,14 +707,3 @@ impl ToComputedValue for specified::MaxLength {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for MaxLength {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
MaxLength::LengthOrPercentageOrNone(lopon) =>
|
||||
lopon.to_css(dest),
|
||||
MaxLength::ExtremumLength(ext) =>
|
||||
ext.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue