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:
Andreas Kling
2026-03-21 09:02:30 -05:00
committed by Andreas Kling
parent b102a68746
commit bc3bd28378
Notes: github-actions[bot] 2026-03-21 23:22:28 +00:00
3 changed files with 48 additions and 50 deletions

View File

@@ -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;
};