mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Move animation-iteration-count outside of mako.
This commit is contained in:
parent
2536e1ee98
commit
dc414134bf
9 changed files with 80 additions and 66 deletions
|
@ -7,8 +7,9 @@
|
|||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use style_traits::ParseError;
|
||||
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
||||
use values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||
use values::specified::AllowQuirks;
|
||||
use values::specified::{AllowQuirks, Number};
|
||||
use values::specified::length::LengthOrPercentage;
|
||||
|
||||
/// A specified value for the `vertical-align` property.
|
||||
|
@ -39,3 +40,28 @@ impl Parse for VerticalAlign {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-animations/#animation-iteration-count
|
||||
pub type AnimationIterationCount = GenericAnimationIterationCount<Number>;
|
||||
|
||||
impl Parse for AnimationIterationCount {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut ::cssparser::Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|input| input.expect_ident_matching("infinite")).is_ok() {
|
||||
return Ok(GenericAnimationIterationCount::Infinite)
|
||||
}
|
||||
|
||||
let number = Number::parse_non_negative(context, input)?;
|
||||
Ok(GenericAnimationIterationCount::Number(number))
|
||||
}
|
||||
}
|
||||
|
||||
impl AnimationIterationCount {
|
||||
/// Returns the value `1.0`.
|
||||
#[inline]
|
||||
pub fn one() -> Self {
|
||||
GenericAnimationIterationCount::Number(Number::new(1.0))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue