<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>257907</bug_id>
          
          <creation_ts>2023-06-09 13:20:08 -0700</creation_ts>
          <short_desc>&lt;animateMotion&gt; non-path animations should apply the &apos;rotate&apos; attribute</short_desc>
          <delta_ts>2026-06-03 22:07:46 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://github.com/web-platform-tests/wpt/pull/60383</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar, WPTImpact</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ahmad Saleem">ahmad.saleem792</reporter>
          <assigned_to name="Ahmad Saleem">ahmad.saleem792</assigned_to>
          <cc>karlcow</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1960814</commentid>
    <comment_count>0</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-06-09 13:20:08 -0700</bug_when>
    <thetext>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&amp;label=master&amp;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!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1962161</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-06-16 13:21:14 -0700</bug_when>
    <thetext>&lt;rdar://problem/110915794&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2133530</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2025-07-30 19:15:05 -0700</bug_when>
    <thetext>Fixes this:

void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount)
{
    RefPtr targetElement = this-&gt;targetElement();
    if (!targetElement)
        return;

    auto* transform = targetElement-&gt;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=&quot;sum&quot; by offsetting by the end-of-path point
        if (repeatCount &amp;&amp; isAccumulated()) {
            FloatPoint positionAtEndOfDuration = m_animationPath.pointAtLength(pathLength);
            position += FloatSize(positionAtEndOfDuration.x() * repeatCount, positionAtEndOfDuration.y() * repeatCount);
        }
    }

    if (!isAdditive())
        transform-&gt;makeIdentity();

    transform-&gt;translate(position.x(), position.y());

    RotateMode rotateMode = this-&gt;rotateMode();
    switch (rotateMode) {
    case RotateAuto:
        break;
    case RotateAutoReverse:
        tangentInDegrees += 180;
        break;
    case RotateAngle:
        tangentInDegrees = 0;
        break;
    }
    transform-&gt;rotate(tangentInDegrees);
}

I carved out part of it here - https://github.com/WebKit/WebKit/pull/48748</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2138505</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2025-08-23 21:45:28 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/49821</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2217425</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-06-03 16:34:42 -0700</bug_when>
    <thetext>Committed 314508@main (50984dcaa2fd): &lt;https://commits.webkit.org/314508@main&gt;

Reviewed commits have been landed. Closing PR #49821 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>