Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f295098a858c1280a342b0d67bb95cf5a58ea583
      
https://github.com/WebKit/WebKit/commit/f295098a858c1280a342b0d67bb95cf5a58ea583
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-03-20 (Fri, 20 Mar 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/set-dynamic-attributeName-css-property-cleanup-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/set-dynamic-attributeName-css-property-cleanup.html
    M Source/WebCore/svg/properties/SVGAttributeAnimator.h

  Log Message:
  -----------
  SVG animation does not clear animated CSS property when attributeName is 
dynamically changed
https://bugs.webkit.org/show_bug.cgi?id=98718
rdar://97097883

Reviewed by Said Abou-Hallawa.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

When JavaScript dynamically changes the attributeName of a SMIL animation
element (e.g. from "opacity" to "x"), the old animated CSS property is never
removed from the target element's animated SMIL style properties.

The root cause is that SVGAttributeAnimator::m_attributeName was a const
reference aliasing the SMIL element's m_attributeName. When setAttributeName()
updated the SMIL element's m_attributeName before calling stopAnimation(),
the animator's stop() method would see the new attribute name ("x") instead
of the old one ("opacity"), causing removeAnimatedStyleProperty() to fail.

Fix by making SVGAttributeAnimator::m_attributeName an owned copy instead
of a reference, so the animator retains the original attribute name
regardless of when the SMIL element updates its own.

Test: 
imported/w3c/web-platform-tests/svg/animations/set-dynamic-attributeName-css-property-cleanup.html

* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/set-dynamic-attributeName-css-property-cleanup-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/set-dynamic-attributeName-css-property-cleanup.html:
 Added.
* Source/WebCore/svg/properties/SVGAttributeAnimator.h:
(WebCore::SVGAttributeAnimator::m_attributeName):

Canonical link: https://commits.webkit.org/309621@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to