Derive ToCss for ViewportLength

This commit is contained in:
Anthony Ramine 2018-03-03 00:38:29 +01:00
parent 6e19fe6a8f
commit 15dcd8a8ea

View file

@ -143,26 +143,14 @@ trait FromMeta: Sized {
/// See:
/// * http://dev.w3.org/csswg/css-device-adapt/#min-max-width-desc
/// * http://dev.w3.org/csswg/css-device-adapt/#extend-to-zoom
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
pub enum ViewportLength {
Specified(LengthOrPercentageOrAuto),
ExtendToZoom
}
impl ToCss for ViewportLength {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
match *self {
ViewportLength::Specified(ref length) => length.to_css(dest),
ViewportLength::ExtendToZoom => dest.write_str("extend-to-zoom"),
}
}
}
impl FromMeta for ViewportLength {
fn from_meta(value: &str) -> Option<ViewportLength> {
macro_rules! specified {