mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
LibWeb: Avoid crash from zero-duration transitions
This commit is contained in:
parent
8e56109515
commit
2cac0dc20c
Notes:
github-actions[bot]
2025-01-08 11:24:13 +00:00
Author: https://github.com/Gingeh
Commit: 2cac0dc20c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3177
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 8 additions and 3 deletions
|
@ -140,6 +140,11 @@ void CSSTransition::visit_edges(Cell::Visitor& visitor)
|
||||||
double CSSTransition::timing_function_output_at_time(double t) const
|
double CSSTransition::timing_function_output_at_time(double t) const
|
||||||
{
|
{
|
||||||
auto progress = (t - transition_start_time()) / (transition_end_time() - transition_start_time());
|
auto progress = (t - transition_start_time()) / (transition_end_time() - transition_start_time());
|
||||||
|
// AD-HOC: If the transition has an empty duration then we get NaN here,
|
||||||
|
// setting progress to 1 because an instant transition may be considered "finished".
|
||||||
|
if (transition_start_time() < transition_end_time())
|
||||||
|
progress = 1;
|
||||||
|
|
||||||
// FIXME: Is this before_flag value correct?
|
// FIXME: Is this before_flag value correct?
|
||||||
bool before_flag = t < transition_start_time();
|
bool before_flag = t < transition_start_time();
|
||||||
return m_keyframe_effect->timing_function().evaluate_at(progress, before_flag);
|
return m_keyframe_effect->timing_function().evaluate_at(progress, before_flag);
|
||||||
|
|
|
@ -2,11 +2,11 @@ Harness status: OK
|
||||||
|
|
||||||
Found 10 tests
|
Found 10 tests
|
||||||
|
|
||||||
5 Pass
|
6 Pass
|
||||||
5 Fail
|
4 Fail
|
||||||
Pass After setting a transition's effect to null, it still reports the original transition property
|
Pass After setting a transition's effect to null, it still reports the original transition property
|
||||||
Pass After setting a transition's effect to null, it becomes finished
|
Pass After setting a transition's effect to null, it becomes finished
|
||||||
Fail After setting a transition's effect to null, style is updated
|
Pass After setting a transition's effect to null, style is updated
|
||||||
Fail After setting a transition's effect to null, a new transition can be started
|
Fail After setting a transition's effect to null, a new transition can be started
|
||||||
Fail After setting a transition's effect to null, it should be possible to interrupt that transition
|
Fail After setting a transition's effect to null, it should be possible to interrupt that transition
|
||||||
Pass After setting a new keyframe effect with a shorter duration, the transition becomes finished
|
Pass After setting a new keyframe effect with a shorter duration, the transition becomes finished
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue