diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index 68049274c12..b627231ecd5 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -200,12 +200,12 @@ impl ToComputedValue for TrackBreadth { } } -#[derive(Clone, Debug, HasViewportPercentage, PartialEq)] -#[cfg_attr(feature = "servo", derive(HeapSizeOf))] /// A `` type for explicit grid track sizing. Like ``, this is /// generic only to avoid code bloat. It only takes `` /// /// https://drafts.csswg.org/css-grid/#typedef-track-size +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] +#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)] pub enum TrackSize { /// A flexible `` Breadth(TrackBreadth), @@ -213,10 +213,12 @@ pub enum TrackSize { /// and a flexible `` /// /// https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-minmax + #[css(comma, function)] Minmax(TrackBreadth, TrackBreadth), /// A `fit-content` function. /// /// https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-fit-content + #[css(function)] FitContent(L), } @@ -259,26 +261,6 @@ impl TrackSize { } } -impl ToCss for TrackSize { - fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match *self { - TrackSize::Breadth(ref b) => b.to_css(dest), - TrackSize::Minmax(ref infexible, ref flexible) => { - dest.write_str("minmax(")?; - infexible.to_css(dest)?; - dest.write_str(", ")?; - flexible.to_css(dest)?; - dest.write_str(")") - }, - TrackSize::FitContent(ref lop) => { - dest.write_str("fit-content(")?; - lop.to_css(dest)?; - dest.write_str(")") - }, - } - } -} - impl ToComputedValue for TrackSize { type ComputedValue = TrackSize;