Thread ParseError return values through CSS parsing.

This commit is contained in:
Josh Matthews 2017-04-28 00:35:22 -04:00
parent 58e39bfffa
commit 27ae1ef2e7
121 changed files with 2133 additions and 1505 deletions

View file

@ -27,12 +27,13 @@ use properties::longhands::transform::computed_value::T as TransformList;
use properties::longhands::vertical_align::computed_value::T as VerticalAlign;
use properties::longhands::visibility::computed_value::T as Visibility;
#[cfg(feature = "gecko")] use properties::{PropertyDeclarationId, LonghandId};
use selectors::parser::SelectorParseError;
#[cfg(feature = "servo")] use servo_atoms::Atom;
use smallvec::SmallVec;
use std::cmp;
#[cfg(feature = "gecko")] use std::collections::HashMap;
use std::fmt;
use style_traits::ToCss;
use style_traits::{ToCss, ParseError};
use super::ComputedValues;
use values::CSSFloat;
use values::{Auto, Either};
@ -99,9 +100,9 @@ impl TransitionProperty {
}
/// Parse a transition-property value.
pub fn parse(input: &mut Parser) -> Result<Self, ()> {
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
let ident = try!(input.expect_ident());
match_ignore_ascii_case! { &ident,
(match_ignore_ascii_case! { &ident,
"all" => Ok(TransitionProperty::All),
% for prop in data.longhands:
% if prop.animatable:
@ -118,7 +119,7 @@ impl TransitionProperty {
None => Ok(TransitionProperty::Unsupported((&*ident).into()))
}
}
}
}).map_err(|()| SelectorParseError::UnexpectedIdent(ident.into()).into())
}
/// Get a transition property from a property declaration.