mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
|
@ -541,58 +541,18 @@ ${helpers.predefined_type("animation-timing-function",
|
|||
allowed_in_keyframe_block=True,
|
||||
spec="https://drafts.csswg.org/css-transitions/#propdef-animation-timing-function")}
|
||||
|
||||
<%helpers:vector_longhand name="animation-iteration-count"
|
||||
need_index="True"
|
||||
animation_value_type="none",
|
||||
extra_prefixes="moz webkit"
|
||||
spec="https://drafts.csswg.org/css-animations/#propdef-animation-iteration-count",
|
||||
allowed_in_keyframe_block="False">
|
||||
pub mod computed_value {
|
||||
pub use super::SpecifiedValue as T;
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-animations/#animation-iteration-count
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss, ToComputedValue)]
|
||||
pub enum SpecifiedValue {
|
||||
Number(f32),
|
||||
Infinite,
|
||||
}
|
||||
|
||||
impl Parse for SpecifiedValue {
|
||||
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(SpecifiedValue::Infinite)
|
||||
}
|
||||
|
||||
let number = input.expect_number()?;
|
||||
if number < 0.0 {
|
||||
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
||||
}
|
||||
|
||||
Ok(SpecifiedValue::Number(number))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn get_initial_value() -> computed_value::T {
|
||||
get_initial_specified_value()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_initial_specified_value() -> SpecifiedValue {
|
||||
SpecifiedValue::Number(1.0)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<SpecifiedValue, ParseError<'i>> {
|
||||
SpecifiedValue::parse(context, input)
|
||||
}
|
||||
</%helpers:vector_longhand>
|
||||
${helpers.predefined_type(
|
||||
"animation-iteration-count",
|
||||
"AnimationIterationCount",
|
||||
"computed::AnimationIterationCount::one()",
|
||||
initial_specified_value="specified::AnimationIterationCount::one()",
|
||||
vector=True,
|
||||
need_index=True,
|
||||
animation_value_type="none",
|
||||
extra_prefixes="moz webkit",
|
||||
allowed_in_keyframe_block=False,
|
||||
spec="https://drafts.csswg.org/css-transitions/#propdef-animation-iteration-count",
|
||||
)}
|
||||
|
||||
<% animation_direction_custom_consts = { "alternate-reverse": "Alternate_reverse" } %>
|
||||
${helpers.single_keyword("animation-direction",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue