Derive HasViewportPercentage 🍷

This commit is contained in:
Anthony Ramine 2017-05-20 01:36:34 +02:00
parent d1e31f7aa4
commit 90bae7f802
27 changed files with 202 additions and 452 deletions

View file

@ -221,7 +221,7 @@ impl<L: ToComputedValue> ToComputedValue for TrackBreadth<L> {
}
}
#[derive(Clone, PartialEq, Debug)]
#[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>`
@ -321,17 +321,6 @@ impl<L: ToCss> ToCss for TrackSize<L> {
}
}
impl HasViewportPercentage for TrackSize<LengthOrPercentage> {
#[inline]
fn has_viewport_percentage(&self) -> bool {
match *self {
TrackSize::Breadth(ref b) => b.has_viewport_percentage(),
TrackSize::MinMax(ref inf_b, ref b) => inf_b.has_viewport_percentage() || b.has_viewport_percentage(),
TrackSize::FitContent(ref lop) => lop.has_viewport_percentage(),
}
}
}
impl<L: ToComputedValue> ToComputedValue for TrackSize<L> {
type ComputedValue = TrackSize<L::ComputedValue>;