Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 89a079c61a9e457fa419fed803f32ba370a6afe2
https://github.com/WebKit/WebKit/commit/89a079c61a9e457fa419fed803f32ba370a6afe2
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-04 (Tue, 04 Aug 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-rotate-angle-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-rotate-angle.html
M LayoutTests/svg/animations/animateMotion-accumulate-1a.svg
M LayoutTests/svg/animations/animateMotion-accumulate-1b.svg
M LayoutTests/svg/animations/animateMotion-accumulate-1c.svg
M Source/WebCore/svg/SVGAnimateMotionElement.cpp
M Source/WebCore/svg/SVGAnimateMotionElement.h
Log Message:
-----------
<animateMotion> ignores a numeric 'rotate' value
https://bugs.webkit.org/show_bug.cgi?id=320821
rdar://183832405
Reviewed by Said Abou-Hallawa.
SVG 2 defines 'rotate' on <animateMotion> as `<number> | auto |
auto-reverse`, where a <number> "indicates that the target element has a
constant rotation transformation applied to it, where the rotation angle
is the specified number of degrees" [1].
rotateMode() folded every value that is not 'auto' or 'auto-reverse'
into RotateMode::Angle, but calculateAnimatedValue() then hardcoded the
angle to 0 for that case, so a specified rotate="45" was silently
dropped and no rotation was applied at all.
Replace rotateMode() with rotate(), which mirrors the attribute grammar
by returning a Variant<RotateMode, float>: the two keywords stay as
RotateMode, and anything else is parsed as a number. This removes the
RotateMode::Angle placeholder, whose only purpose was to mean "not a
keyword". An absent or unparseable value still yields no rotation,
matching the initial value of 0.
Firefox already applies the specified angle; Chrome shares the WebKit
behavior of dropping it.
The svg/animations/animateMotion-accumulate-1a..1c tests need slightly
wider fuzziness. Each of them animates four circles, and while three use
no 'rotate', 'auto' and 'auto-reverse', the innermost one specifies
rotate="60", which this change stops discarding. Those circles are
centered on the rotation origin, so a 60 degree rotation maps each one
onto itself and the rendered geometry is unchanged; only the rasterized
result moves, because the Bezier arcs making up the circle now meet the
pixel grid at rotated positions and are antialiased slightly
differently. The tests already needed fuzziness before this change, as
the accumulated translation comes from an approximate path traversal.
[1] https://w3c.github.io/svgwg/specs/animations/#RotateAttribute
Test:
imported/w3c/web-platform-tests/svg/animations/animateMotion-rotate-angle.html
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-rotate-angle-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/animateMotion-rotate-angle.html:
Added.
* LayoutTests/svg/animations/animateMotion-accumulate-1a.svg: Widen fuzziness
for the rotate="60" circle.
* LayoutTests/svg/animations/animateMotion-accumulate-1b.svg: Ditto.
* LayoutTests/svg/animations/animateMotion-accumulate-1c.svg: Ditto.
* Source/WebCore/svg/SVGAnimateMotionElement.cpp:
(WebCore::SVGAnimateMotionElement::rotate const):
(WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
(WebCore::SVGAnimateMotionElement::rotateMode const): Deleted.
* Source/WebCore/svg/SVGAnimateMotionElement.h:
Canonical link: https://commits.webkit.org/318565@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications