#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[allow(missing_docs)]
pub enum ViewportLength
{
auto,
value(CalculablePropertyValue<LengthOrPercentageUnit<CssUnsignedNumber>>),
}
impl ToCss for ViewportLength
{
fn to_css<W: fmt::Write>(&self, dest: &mut W) -> fmt::Result
{
match *self
{
auto => dest.write_str("auto"),
value(ref numeric_value) => numeric_value.to_css(dest),
}
}
}
impl ViewportLength
{
pub(crate) fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i, CustomParseError<'i>>>
{
use self::ViewportLength::*;
if input.try(|i| i.expect_ident_matching("auto")).is_ok()
{
return Ok(auto);
}
Ok(value(LengthOrPercentageUnit::parse_one_outside_calc_function(context, input)?))
}
}