Fix CSS step timing functions jump-both, jump-start, start at timestamp 0; Early return when possible#354
Fix CSS step timing functions jump-both, jump-start, start at timestamp 0; Early return when possible#354
jump-both, jump-start, start at timestamp 0; Early return when possible#354Conversation
|
@Loirooriol Just friendly reminder. |
|
|
||
| let prev_keyframe = &self.computed_steps[prev_keyframe_index]; | ||
| let Some(next_keyframe_index) = next_keyframe_index else { | ||
| debug_assert!(false, "next_keyframe_index should always be Some"); |
There was a problem hiding this comment.
Using debug_unreachable may be clearer.
Also the message isn't providing much, it should rather explain why.
There was a problem hiding this comment.
Done in 2701332
The explanation is a bit lengthy tho. We are relying on
stylo/style/servo/animation.rs
Lines 175 to 176 in 40aa59d
| // Progress clamped to the current iteration (0.0 to 1.0). | ||
| let total_progress = progress.min(self.current_iteration_end_progress()).max(0.0); | ||
|
|
||
| if total_progress >= 1.0 { |
There was a problem hiding this comment.
Why can this handle the equality, but above you check progress < 0.0?
There was a problem hiding this comment.
In 2701332 I updated to ==1.0 as it is always in [0,1].
but above you check
progress < 0.0?
At progress == 0.0, we don't want to early return because we need to reach the step‑function handling block at L878 we added.
There was a problem hiding this comment.
But don't we have the same jumping problem at the end?
There was a problem hiding this comment.
End has always been fine. We only have problem at the beginning.
398c241 to
1d1f9ce
Compare
…rst keyframe to be selected at progress 0; changed to < for normal direction (kept <= for reverse to avoid #342 (comment)) and added direction‑aware step‑function handling. - Guard against division‑by‑zero for zero‑length keyframe intervals. 1. total_progress ≥ 1.0 and total_progress < 0 now handled immediately. Also make it direction aware. 2. At timestamp 0, for normal direction, non‑jump step functions (jump‑end, jump‑none, end) now return the start‑keyframe value early, instead of proceeding to interpolation. 3. Zero-interval: we exit early to avoid division‑by‑zero in `percentage_between_keyframes` Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
dbc9ddd to
0cf455c
Compare
jump-both,jump-start,startat timestamp 0; Early return when possible #342 (comment)) and added direction‑aware step‑function handling.Make early return happen earlier:
percentage_between_keyframesTry
Servo PR: servo/servo#44365