diff --git a/components/style/animation.rs b/components/style/animation.rs index c69aca08bde..6eae69e8183 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -355,7 +355,15 @@ impl PropertyAnimation { TransitionTimingFunction::Frames(frames) => { // https://drafts.csswg.org/css-timing/#frames-timing-functions let mut out = (time * (frames as f64)).floor() / ((frames - 1) as f64); - if out > 1.0 && time <= 1.0 { + if out > 1.0 { + // FIXME: Basically, during the animation sampling process, the input progress + // should be in the range of [0, 1]. However, |time| is not accurate enough + // here, which means |time| could be larger than 1.0 in the last animation + // frame. (It should be equal to 1.0 exactly.) This makes the output of frames + // timing function jumps to the next frame/level. + // However, this solution is still not correct because |time| is possible + // outside the range of [0, 1] after introducing Web Animations. We should fix + // this problem when implementing web animations. out = 1.0; } out