<?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>281404</bug_id>
          
          <creation_ts>2024-10-13 17:38:01 -0700</creation_ts>
          <short_desc>SVG Animation Event names might need to be special-cased</short_desc>
          <delta_ts>2026-03-13 21:10:39 -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>DOM</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>63727</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ahmad Saleem">ahmad.saleem792</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>karlcow</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2067630</commentid>
    <comment_count>0</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-10-13 17:38:01 -0700</bug_when>
    <thetext>Hi Team,

While looking into why we don&apos;t have following EventHandlers in the `SVGAnimationElement.idl`:

  attribute EventHandler onbegin;
  attribute EventHandler onend;
  attribute EventHandler onrepeat;

Web Specification: https://svgwg.org/specs/animations/#InterfaceSVGAnimationElement

__

When we have to add them in bug 275669 (PR - https://github.com/WebKit/WebKit/pull/29984), it is something where we need to add.

`begin` in (EventNames), where this can be linked with `onbegin` instead of `EventNames` automatically linking with `beginEvent` (which we already have).

Without adding `begin`, we fail `idlharness.html` tests in `svg` directory.

___

We have following already.

`beginEvent`
`endEvent`

in EventNames.json but if I add just `idl` bits, it does not compile and give error (at least for begin) but if I add `begin` then it compiles.

Although, it leads to another WPT test failures.

____

So now why we need special case:

1) We already have `end` and `endEvent` in `EventNames.json`
2) Now if I add `attribute EventHandler.json
3) It compiles and progress one test in WPT but at the same time leads to this failure.

FAILURE: https://wpt.fyi/results/svg/animations/custom-events.html?label=experimental&amp;label=master&amp;aligned

___

Now look into failure: 

First test -&gt; custom events with the name &apos;end&apos; should only call the event listener for the event &apos;end&apos; and no attribute handlers or IDL listeners
Second -&gt; custom events with the name &apos;endEvent&apos; should call &apos;onend&apos; attribute handlers and IDL property listeners, and &apos;endEvent&apos; listeners	

By adding `IDL`, we start failing first one.

___

We need to make sure, `endEvent` map to `onend` and similarly for other `beginEvent` map to `onbegin` etc.

____

This was done via something like this in blink:

+    DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(begin, beginEvent);
+    DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(end, endEvent);
+    DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(repeat, repeatEvent);

Commit - https://codereview.chromium.org/201673003

___

We have removed `DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER` macro as well.

____

If we add `begin` in EventNames.json, it leads to following `Safe C++` [Smart Pointer] violation: https://ews-build.webkit.org/#/builders/120/builds/1177

&apos;Found 1 new failure in JSSVGAnimationElement.cpp&apos;

=&gt; UncountedCallArgsChecker
JSSVGAnimationElement.cpp

___

Just raising so we can fix it.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2069500</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-10-20 17:38:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/138288795&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2073406</commentid>
    <comment_count>2</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-11-06 22:55:55 -0800</bug_when>
    <thetext>https://searchfox.org/wubkat/rev/d45649fa32a499702c30474e94bd6843c4c67849/Source/WebCore/svg/SVGAnimationElement.idl

SMIL has attributes.
https://searchfox.org/wubkat/rev/d45649fa32a499702c30474e94bd6843c4c67849/Source/WebCore/svg/animation/SVGSMILElement.cpp#513-518</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2138992</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2025-08-27 00:33:29 -0700</bug_when>
    <thetext>To fix:

1) Go to `EventNames.json`, keep only `beginEvent`, `endEvent` and `repeatEvent`.
2) In IDL file - add all `onbegin`, `onend`, `onrepeat`.
3) Now go to `dom/make-event-names.py` and make special case above so we link `onbegin = beginEvent`, `onend = endEvent` and `onrepeat = repeatEvent`.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2138993</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2025-08-27 00:35:41 -0700</bug_when>
    <thetext>(In reply to Ahmad Saleem from comment #3)
&gt; To fix:
&gt; 
&gt; 1) Go to `EventNames.json`, keep only `beginEvent`, `endEvent` and
&gt; `repeatEvent`.
&gt; 2) In IDL file - add all `onbegin`, `onend`, `onrepeat`.
&gt; 3) Now go to `dom/make-event-names.py` and make special case above so we
&gt; link `onbegin = beginEvent`, `onend = endEvent` and `onrepeat = repeatEvent`.

4) Remove `begin`, `end` and `repeat` from EventNames.json file.
5) Might need to fix SVGSMILElement.cpp file where we have currently `beginEventEvent` calls and other bits.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2190239</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2026-03-13 21:10:39 -0700</bug_when>
    <thetext>Manage to solve with `ImplementAs` solution in IDL generation. Implementing last puzzle piece here - https://github.com/WebKit/WebKit/pull/60616</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>