mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibWeb: Use machine epsilon when approximating cubic bezier
This commit is contained in:
parent
9395b266c6
commit
c2cd191864
Notes:
github-actions[bot]
2024-11-03 16:36:14 +00:00
Author: https://github.com/Gingeh
Commit: c2cd191864
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2119
3 changed files with 29 additions and 4 deletions
|
@ -0,0 +1 @@
|
||||||
|
PASS! (Didn't crash)
|
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<style>
|
||||||
|
#foo {
|
||||||
|
animation-name: anim;
|
||||||
|
animation-play-state: paused;
|
||||||
|
animation-fill-mode: forwards;
|
||||||
|
animation-timing-function: cubic-bezier(0.4, 0.1, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes anim {}
|
||||||
|
</style>
|
||||||
|
<div id="foo"></div>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
asyncTest(async (done) => {
|
||||||
|
const foo = document.getElementById("foo");
|
||||||
|
const anim = foo.getAnimations()[0];
|
||||||
|
anim.onfinish = function () {
|
||||||
|
println("PASS! (Didn't crash)");
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
anim.play();
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -126,9 +126,9 @@ double EasingStyleValue::Function::evaluate_at(double input_progress, bool befor
|
||||||
|
|
||||||
size_t nearby_index = 0;
|
size_t nearby_index = 0;
|
||||||
if (auto found = binary_search(cached_x_samples, x, &nearby_index, [](auto x, auto& sample) {
|
if (auto found = binary_search(cached_x_samples, x, &nearby_index, [](auto x, auto& sample) {
|
||||||
if (x > sample.x)
|
if (x - sample.x >= NumericLimits<double>::epsilon())
|
||||||
return 1;
|
return 1;
|
||||||
if (x < sample.x)
|
if (x - sample.x <= NumericLimits<double>::epsilon())
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}))
|
}))
|
||||||
|
@ -146,9 +146,9 @@ double EasingStyleValue::Function::evaluate_at(double input_progress, bool befor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto found = binary_search(cached_x_samples, x, &nearby_index, [](auto x, auto& sample) {
|
if (auto found = binary_search(cached_x_samples, x, &nearby_index, [](auto x, auto& sample) {
|
||||||
if (x > sample.x)
|
if (x - sample.x >= NumericLimits<double>::epsilon())
|
||||||
return 1;
|
return 1;
|
||||||
if (x < sample.x)
|
if (x - sample.x <= NumericLimits<double>::epsilon())
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue