SMIL work: performance and integration

Archive SMIL

Here’s an updated patch with my latest changes including:

  • Optimised performance—a lot of unnecessary rendering has been filtered out and the profiling I was able to perform suggests this has made a significant difference, especially when the animation is frozen.
  • Animation now pauses and resets when the page is cached in the bfcache.
  • Better thread safety.
  • Animation now starts at the same time as the SVGLoad event (although this has meant a regression in the deferred tree test case).
  • Support for pausing via the DOM (see this test case).
  • Animation is now disabled if the image.animation_mode pref is set to ‘none’ (although I’m not sure if this is a good idea).
  • Fixed the to-animation prioritisation issue Olaf pointed out.
  • The frozen to animation test case now produces the correct result in all cases (although there are still unresolved issues with regard to seeking).

The latest patch is at: smil-anim-2005-10-16-1736.patch.

I’ve also put up my configure script as some people have had trouble regenerating the script from

You might like to read Twitwi’s comment for some help on applying the patch.



I was just browsing through the patch…
The following doesn’t look right, someone may use svg.addEventListener(...) to handle the svg load event.

+  if (aEvent->message == NS_SVG_LOAD) {
+    if (mAnimationRegistry)
+      mAnimationRegistry->Start();
+    if (!HasAttr(kNameSpaceID_None, nsSVGAtoms::onload))
+      return NS_OK;
+  }

Yes you’re right. This part definitely needs more thought. Relying on events also means that SVG documents added entirely by script won’t animate.

As for breaking scripts that add event listeners to the svg load event, this is already broken as load events are only dispatched if the onload attribute is specified. See:

This will have to be reconsidered when bug 277955 is handled (‘onload should respect externalResourcesRequired’).

But now that you’ve raised it, I’ll look into other ways of starting animation.

Thanks smaug,



Will this be in 1.5?


No, I’m afraid not. There’s still a long way to go before declarative animation is ready. Hopefully we’ll have it by 2.0.

Leave a reply

Most markdown like **bold** and _italic_ is supported.

Never shown. Only used for looking up your gravatar.