Move Position::parse_legacy logic to LegacyPosition type

This commit is contained in:
Nazım Can Altınova 2017-06-23 16:17:26 -07:00
parent d589645ee9
commit b33545ca3b
4 changed files with 220 additions and 82 deletions

View file

@ -124,6 +124,13 @@ impl<S> ToComputedValue for OriginComponent<S>
}
}
impl<S> OriginComponent<S> {
/// `0%`
pub fn zero() -> Self {
OriginComponent::Length(LengthOrPercentage::Percentage(Percentage(0.)))
}
}
impl Parse for TimingFunction {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
if let Ok(keyword) = input.try(TimingKeyword::parse) {