Support unit variants when deriving ToCss

This commit is contained in:
Anthony Ramine 2017-06-07 14:53:31 +02:00
parent 7d09ce0495
commit 45e8b0e8c7
14 changed files with 71 additions and 242 deletions

View file

@ -19,7 +19,7 @@ pub type ClippingShape<BasicShape> = ShapeSource<BasicShape, GeometryBox>;
/// https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
pub enum GeometryBox {
FillBox,
StrokeBox,
@ -142,17 +142,6 @@ impl<B: ToCss, T: ToCss> ToCss for ShapeSource<B, T> {
}
}
impl ToCss for GeometryBox {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self {
GeometryBox::FillBox => dest.write_str("fill-box"),
GeometryBox::StrokeBox => dest.write_str("stroke-box"),
GeometryBox::ViewBox => dest.write_str("view-box"),
GeometryBox::ShapeBox(s) => s.to_css(dest),
}
}
}
impl<L> ToCss for InsetRect<L>
where L: ToCss + PartialEq
{