Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b113f83f34dd67b5a2e1c94feb544c39db415cf2
https://github.com/WebKit/WebKit/commit/b113f83f34dd67b5a2e1c94feb544c39db415cf2
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-10 (Mon, 10 Aug 2026)
Changed paths:
M Source/WebCore/svg/SVGAnimateMotionElement.cpp
M Source/WebCore/svg/SVGAnimateMotionElement.h
Log Message:
-----------
[SVG] animateMotion walks the animation path up to 4 times per frame
https://bugs.webkit.org/show_bug.cgi?id=320823
rdar://183833913
Reviewed by Nikolas Zimmermann.
buildTransformForProgress() called Path::length() and
Path::traversalStateAtLength() to get the position, then its only caller
immediately recomputed both with identical arguments just to read
normalAngle(). Both are full applyElements() walks, O(segments) with
per-curve subdivision, and Path caches neither. The accumulation loop
added 2 more walks per repeat for a loop-invariant result.
Inline the helper so the position and angle come from one traversal
state, hoist Path::length(), and compute the end-of-path position once
before the accumulation loop. That is 4 + 2 * repeatCount walks per
frame down to 1, or 2 when accumulating.
No behavior change. The angle now comes from a state with the same input
as the one it replaces, including on failure, which the old code also
read from. The loop still composes repeatCount separate translations
rather than one scaled translation, since AffineTransform accumulates
through tx * a + ty * c.
* Source/WebCore/svg/SVGAnimateMotionElement.cpp:
(WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
(WebCore::SVGAnimateMotionElement::buildTransformForProgress): Deleted.
* Source/WebCore/svg/SVGAnimateMotionElement.h:
Canonical link: https://commits.webkit.org/318880@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications