RESOLVED FIXED 150393
Support for the SVG `onend` attribute
https://bugs.webkit.org/show_bug.cgi?id=150393
Summary Support for the SVG `onend` attribute
Antoine Quint
Reported 2015-10-21 08:52:43 PDT
While we've added support for the `endEvent` event in SVG (see https://bugs.webkit.org/show_bug.cgi?id=121587), we have not added support for the `onend` attribute which allows a JS event listener to be added declaratively for the `endEvent` event.
Attachments
Patch (9.15 KB, patch)
2015-10-21 08:56 PDT, Antoine Quint
no flags
Antoine Quint
Comment 1 2015-10-21 08:56:28 PDT
Radar WebKit Bug Importer
Comment 2 2015-10-21 08:57:22 PDT
WebKit Commit Bot
Comment 3 2015-10-21 11:30:22 PDT
Comment on attachment 263680 [details] Patch Clearing flags on attachment: 263680 Committed r191392: <http://trac.webkit.org/changeset/191392>
WebKit Commit Bot
Comment 4 2015-10-21 11:30:26 PDT
All reviewed patches have been landed. Closing bug.
Said Abou-Hallawa
Comment 5 2015-10-21 11:37:34 PDT
Comment on attachment 263680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=263680&action=review > LayoutTests/svg/animations/end-event-attribute-expected.svg:2 > +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd"> I think you do not have to include the tags <?xml> and <!DOCTYPE>. > LayoutTests/svg/animations/end-event-attribute-expected.svg:3 > +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> You do not need to include xmlns:xlink="http://www.w3.org/1999/xlink" since you are not using this namespace in the SVG. > LayoutTests/svg/animations/end-event-attribute.svg:12 > + document.getElementById("rect").setAttribute("fill", "green"); Do not you need to force layout or setTimeout() before notifyDone() to make sure the test runner captures the page in a steady state?
Antoine Quint
Comment 6 2015-10-21 11:45:20 PDT
(In reply to comment #5) > > LayoutTests/svg/animations/end-event-attribute-expected.svg:2 > > +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd"> > > I think you do not have to include the tags <?xml> and <!DOCTYPE>. That's true, doesn't hurt. I might update those tests in an upcoming related patch (thinking of implementing the `beginEvent` event and `onbegin` attribute). > > LayoutTests/svg/animations/end-event-attribute-expected.svg:3 > > +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> > > You do not need to include xmlns:xlink="http://www.w3.org/1999/xlink" since > you are not using this namespace in the SVG. True too. Will look again when adding related features. > > LayoutTests/svg/animations/end-event-attribute.svg:12 > > + document.getElementById("rect").setAttribute("fill", "green"); > > Do not you need to force layout or setTimeout() before notifyDone() to make > sure the test runner captures the page in a steady state? At least on my system, tests have been running reliably without the need for a forced layout.
Darin Adler
Comment 7 2015-10-21 13:00:42 PDT
Comment on attachment 263680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=263680&action=review > Source/WebCore/svg/animation/SVGSMILElement.cpp:485 > + } else if (name == SVGNames::onendAttr) { > + setAttributeEventListener(eventNames().endEventEvent, name, value); > } else This looks good, but coding style for a one liner like this is supposed to be no braces. What is going on with the name endEventEvent? What? Is the event named "end" or is it named "endEvent"?
Antoine Quint
Comment 8 2015-10-22 02:09:02 PDT
Comment on attachment 263680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=263680&action=review >> Source/WebCore/svg/animation/SVGSMILElement.cpp:485 >> } else > > This looks good, but coding style for a one liner like this is supposed to be no braces. > > What is going on with the name endEventEvent? What? Is the event named "end" or is it named "endEvent"? Can't believe I missed the style compliance. Odd also that the style bot didn't catch my error. Filed https://bugs.webkit.org/show_bug.cgi?id=150440 to follow up on that. I will be making more changes to that area very soon and I will take the time to fix this error as well if that's alright. If you'd rather, I can make a quicker fix dedicated to fixing this. As for the event name, yes, believe it or not, it's called `endEvent` (see http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent), but the attribute to register an `endEvent` event listener declaratively is `onend` (see http://www.w3.org/TR/SVG/script.html#AnimationEvents). Not that there is also an `end` event supported by WebKit for speech synthesis.
Antoine Quint
Comment 9 2015-10-22 03:44:27 PDT
Said, Darin, I've made the changes you've suggested in the patch for https://bugs.webkit.org/show_bug.cgi?id=150442.
Note You need to log in before you can comment on or make changes to this bug.