Make ShapeRadius generic

This commit is contained in:
Ravi Shankar 2017-04-12 23:13:59 +05:30
parent b2b3f99427
commit a36bf9efc4
4 changed files with 72 additions and 98 deletions

View file

@ -15,7 +15,8 @@ use values::{Auto, Either, ExtremumLength, None_, Normal};
use values::computed::{Angle, LengthOrPercentage, LengthOrPercentageOrAuto};
use values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage};
use values::computed::{MaxLength, MinLength};
use values::computed::basic_shape::ShapeRadius;
use values::computed::basic_shape::ShapeRadius as ComputedShapeRadius;
use values::generics::basic_shape::ShapeRadius;
use values::specified::Percentage;
use values::specified::grid::{TrackBreadth, TrackKeyword};
@ -205,15 +206,13 @@ impl<L: GeckoStyleCoordConvertible> GeckoStyleCoordConvertible for TrackBreadth<
}
}
impl GeckoStyleCoordConvertible for ShapeRadius {
impl GeckoStyleCoordConvertible for ComputedShapeRadius {
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
match *self {
ShapeRadius::ClosestSide => {
coord.set_value(CoordDataValue::Enumerated(StyleShapeRadius::ClosestSide as u32))
}
ShapeRadius::FarthestSide => {
coord.set_value(CoordDataValue::Enumerated(StyleShapeRadius::FarthestSide as u32))
}
ShapeRadius::ClosestSide =>
coord.set_value(CoordDataValue::Enumerated(StyleShapeRadius::ClosestSide as u32)),
ShapeRadius::FarthestSide =>
coord.set_value(CoordDataValue::Enumerated(StyleShapeRadius::FarthestSide as u32)),
ShapeRadius::Length(lop) => lop.to_gecko_style_coord(coord),
}
}