WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
257907
<animateMotion> non-path animations should apply the 'rotate' attribute
https://bugs.webkit.org/show_bug.cgi?id=257907
Summary
<animateMotion> non-path animations should apply the 'rotate' attribute
Ahmad Saleem
Reported
2023-06-09 13:20:08 PDT
Hi Team, This is another WPT test failure unique to Safari / WebKit and it would be good to track and fix it in future. WPT Test Link:
https://wpt.fyi/results/svg/animations/animateMotion-from-to-rotate-auto.html?label=experimental&label=master&aligned
WPT Live Link:
http://wpt.live/svg/animations/animateMotion-from-to-rotate-auto.html
Blink Link:
https://chromium.googlesource.com/chromium/src/+/7f43c0d43ff1b00697461a588118d69e8d86238a
Just wanted to raise so we can fix it. Thanks!
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-06-16 13:21:14 PDT
<
rdar://problem/110915794
>
Ahmad Saleem
Comment 2
2025-07-30 19:15:05 PDT
Fixes this: void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount) { RefPtr targetElement = this->targetElement(); if (!targetElement) return; auto* transform = targetElement->ensureSupplementalTransform(); if (!transform) return; FloatPoint position; float tangentInDegrees = 0; if (animationMode() != AnimationMode::Path) { FloatPoint toPointAtEndOfDuration = m_toPointAtEndOfDuration ? *m_toPointAtEndOfDuration : m_toPoint; float animatedX = 0; animateAdditiveNumber(percentage, repeatCount, m_fromPoint.x(), m_toPoint.x(), toPointAtEndOfDuration.x(), animatedX); float animatedY = 0; animateAdditiveNumber(percentage, repeatCount, m_fromPoint.y(), m_toPoint.y(), toPointAtEndOfDuration.y(), animatedY); position = FloatPoint(animatedX, animatedY); tangentInDegrees = rad2deg(atan2(m_toPoint.y() - m_fromPoint.y(), m_toPoint.x() - m_fromPoint.x())); } else { ASSERT(!m_animationPath.isEmpty()); const float pathLength = m_animationPath.length(); const float positionOnPath = pathLength * percentage; auto traversalState = m_animationPath.traversalStateAtLength(positionOnPath); if (!traversalState.success()) return; position = traversalState.current(); tangentInDegrees = traversalState.normalAngle(); // Handle accumulate="sum" by offsetting by the end-of-path point if (repeatCount && isAccumulated()) { FloatPoint positionAtEndOfDuration = m_animationPath.pointAtLength(pathLength); position += FloatSize(positionAtEndOfDuration.x() * repeatCount, positionAtEndOfDuration.y() * repeatCount); } } if (!isAdditive()) transform->makeIdentity(); transform->translate(position.x(), position.y()); RotateMode rotateMode = this->rotateMode(); switch (rotateMode) { case RotateAuto: break; case RotateAutoReverse: tangentInDegrees += 180; break; case RotateAngle: tangentInDegrees = 0; break; } transform->rotate(tangentInDegrees); } I carved out part of it here -
https://github.com/WebKit/WebKit/pull/48748
Ahmad Saleem
Comment 3
2025-08-23 21:45:28 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/49821
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug