<animate> is dropped when embedding an SVG via <use href>

#40853412 Area: Blink>SVG / SMIL CL 8646510 In Review

What happens

A <use> that points into another SVG document renders the shape but never animates it. Three things had to line up for that:

Same-document <use> looked fine because the referenced element animates and the instance inherits its SMIL properties -- only external references were dead. The CL clones the animation elements (and the <mpath> an <animateMotion> may contain) so an instance is created in the shadow tree, and resolves a timed element's target in its own tree scope instead of the referenced element's originating scope. Per SVG2 UseAnimations an instanced animation element may only affect a target in the same node tree, so this keeps the animation in-tree and lets the clone drive its instance; the style resolver then uses the instance's own SMIL properties. Behind the default-on SvgUseInstanceAnimations kill switch.

Because targeting is now scoped to the element's own tree, a shadow-tree animation can no longer reach out of its tree, so the inert guard added for crrev.com/c/8610829 (a security fix) is only retained for the feature-off path rather than being removed.

External reference, in-document symbol, and in-tree-only targeting, all frozen past the animation

Your browser, three cases top to bottom: external reference, in-document symbol, and in-tree-only targeting.
Before: external square red, decoy blue, instanced target red
Without the patch: the external animation never runs (red), and the instanced #target stays red.
After: external green, decoy still blue, instanced target green
With the patch: external and instanced targets animate to green; the same-id light-tree #target stays blue, never reached by the shadow-tree animation.
Diff mask over the external and instanced squares
20100 px differ -- the external square and the instanced in-tree target; the light-tree decoy is unchanged.

Verification

Links

Issue 40853412 CL 8646510 standalone sampler.html capture_screenshots.py