diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/style/values/generics/grid.rs | 26 |
1 files changed, 4 insertions, 22 deletions
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<L: ToComputedValue> ToComputedValue for TrackBreadth<L> { } } -#[derive(Clone, Debug, HasViewportPercentage, PartialEq)] -#[cfg_attr(feature = "servo", derive(HeapSizeOf))] /// A `<track-size>` type for explicit grid track sizing. Like `<track-breadth>`, this is /// generic only to avoid code bloat. It only takes `<length-percentage>` /// /// https://drafts.csswg.org/css-grid/#typedef-track-size +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] +#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)] pub enum TrackSize<L> { /// A flexible `<track-breadth>` Breadth(TrackBreadth<L>), @@ -213,10 +213,12 @@ pub enum TrackSize<L> { /// and a flexible `<track-breadth>` /// /// https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-minmax + #[css(comma, function)] Minmax(TrackBreadth<L>, TrackBreadth<L>), /// 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<L: PartialEq> TrackSize<L> { } } -impl<L: ToCss> ToCss for TrackSize<L> { - fn to_css<W>(&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<L: ToComputedValue> ToComputedValue for TrackSize<L> { type ComputedValue = TrackSize<L::ComputedValue>; |