1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00

LibWeb: Don't crash when interpolating single-value repeatable lists

Previously, when interpolating a repeatable list from a list with
multiple values to a single value, we would crash.
This commit is contained in:
Tim Ledbetter 2025-06-01 16:20:45 +01:00 committed by Sam Atkins
parent 8ded0c65dc
commit 17f14a277b
Notes: github-actions[bot] 2025-06-02 10:34:09 +00:00
3 changed files with 26 additions and 1 deletions

View file

@ -932,7 +932,7 @@ RefPtr<CSSStyleValue const> interpolate_repeatable_list(DOM::Element& element, C
if (!from.is_value_list() && to.is_value_list())
from_list = make_single_value_list(from, to.as_value_list().size(), to.as_value_list().separator());
else if (!to.is_value_list() && from.is_value_list())
to_list = make_single_value_list(to, from.as_value_list().size(), to.as_value_list().separator());
to_list = make_single_value_list(to, from.as_value_list().size(), from.as_value_list().separator());
else if (!from.is_value_list() && !to.is_value_list())
return interpolate_value(element, calculation_context, from, to, delta, allow_discrete);

View file

@ -0,0 +1 @@
PASS (didn't crash!)

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<!-- FIXME: Ideally this would be a crash test, but the test harness doesn't wait long enough for the crash to occur -->
<script src="../include.js"></script>
<div></div>
<script>
asyncTest(done => {
const element = document.querySelector('div');
const animation = element.animate([
{ backgroundSize: '10% 10%, 20% 20%' },
{ backgroundSize: 'auto auto' }
], {
duration: 1000,
});
animation.finished.then(() => {
println("PASS (didn't crash!)");
done();
});
requestAnimationFrame(() => {
requestAnimationFrame(() => {
animation.finish();
});
});
});
</script>