mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Use Newton-Raphson for cubic-bezier easing evaluation
Replace the previous caching/binary-search approach with Newton-Raphson iteration and bisection fallback. This is the same algorithm used by WebKit, Chromium, and Firefox. The old code had a broken binary search comparator that could never return 0 (the second condition was always true when the first was false), leading to out-of-bounds vector accesses and crashes. Fixes #3628.
This commit is contained in:
committed by
Andreas Kling
parent
b102a68746
commit
bc3bd28378
Notes:
github-actions[bot]
2026-03-21 23:22:28 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/bc3bd28378d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8552
@@ -29,14 +29,6 @@ struct CubicBezierEasingFunction {
|
||||
double y2;
|
||||
String stringified;
|
||||
|
||||
struct CachedSample {
|
||||
double x;
|
||||
double y;
|
||||
double t;
|
||||
};
|
||||
|
||||
mutable Vector<CachedSample> m_cached_x_samples {};
|
||||
|
||||
double evaluate_at(double input_progress, bool before_flag) const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user