Skip to content

Commit 1a41cbe

Browse files
committed
Simon's comment
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
1 parent 6d1e8dd commit 1a41cbe

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

style/servo/animation.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,8 @@ impl Animation {
591591
return;
592592
}
593593

594-
// Raw progress ratio of the animation: can be negative (before start) or >1.0 (after end).
594+
// Raw progress ratio of the animation: can be negative (before start) or
595+
// >1.0 (after end or during multiple iterations).
595596
let progress = match self.state {
596597
AnimationState::Running | AnimationState::Pending | AnimationState::Finished => {
597598
(now - self.started_at) / self.duration
@@ -688,7 +689,8 @@ impl Animation {
688689
},
689690
};
690691

691-
// Detect zero interval. Prevent division by zero from percentage_between_keyframes.
692+
// Prevent division by zero from percentage_between_keyframes.
693+
// This can happen for reverse direction at total_progress == 0.0.
692694
if Some(prev_keyframe_index) == next_keyframe_index {
693695
add_declarations_to_map(&prev_keyframe);
694696
return;

0 commit comments

Comments
 (0)