mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
animation-iteration-count property is a number instead of integer.
This commit is contained in:
parent
16b0da5004
commit
f78cd2caf1
4 changed files with 31 additions and 8 deletions
|
@ -32,7 +32,7 @@ pub enum KeyframesIterationState {
|
|||
/// Infinite iterations, so no need to track a state.
|
||||
Infinite,
|
||||
/// Current and max iterations.
|
||||
Finite(u32, u32),
|
||||
Finite(f32, f32),
|
||||
}
|
||||
|
||||
/// This structure represents wether an animation is actually running.
|
||||
|
@ -92,7 +92,7 @@ impl KeyframesAnimationState {
|
|||
}
|
||||
|
||||
if let KeyframesIterationState::Finite(ref mut current, ref max) = self.iteration_state {
|
||||
*current += 1;
|
||||
*current += 1.0;
|
||||
// NB: This prevent us from updating the direction, which might be
|
||||
// needed for the correct handling of animation-fill-mode.
|
||||
if *current >= *max {
|
||||
|
@ -473,7 +473,7 @@ pub fn maybe_start_animations(context: &SharedStyleContext,
|
|||
let duration = box_style.animation_duration_mod(i).seconds();
|
||||
let iteration_state = match box_style.animation_iteration_count_mod(i) {
|
||||
AnimationIterationCount::Infinite => KeyframesIterationState::Infinite,
|
||||
AnimationIterationCount::Number(n) => KeyframesIterationState::Finite(0, n),
|
||||
AnimationIterationCount::Number(n) => KeyframesIterationState::Finite(0.0, n),
|
||||
};
|
||||
|
||||
let animation_direction = box_style.animation_direction_mod(i);
|
||||
|
|
|
@ -828,10 +828,11 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
|
||||
pub use self::AnimationIterationCount as SingleComputedValue;
|
||||
|
||||
// https://drafts.csswg.org/css-animations/#animation-iteration-count
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum AnimationIterationCount {
|
||||
Number(u32),
|
||||
Number(f32),
|
||||
Infinite,
|
||||
}
|
||||
|
||||
|
@ -841,12 +842,12 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
return Ok(AnimationIterationCount::Infinite)
|
||||
}
|
||||
|
||||
let number = try!(input.expect_integer());
|
||||
if number < 0 {
|
||||
let number = try!(input.expect_number());
|
||||
if number < 0.0 {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
Ok(AnimationIterationCount::Number(number as u32))
|
||||
Ok(AnimationIterationCount::Number(number))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -886,7 +887,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
|
||||
#[inline]
|
||||
pub fn get_initial_single_value() -> AnimationIterationCount {
|
||||
AnimationIterationCount::Number(1)
|
||||
AnimationIterationCount::Number(1.0)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue