[Webkit-unassigned] [Bug 81792] Triggering an animation in cloned (uses) object causes all other cloned objects to animate

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Mar 23 06:39:52 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=81792





--- Comment #12 from David White <david at netriver.co.uk>  2012-03-23 06:39:52 PST ---
Nikolas,

We had a collision! I'll post what I was writing anyway in case that helps at all. Thanks again for looking at this.

-David.

> Implementation note:
> In WebKit we do clone the referenced element of a <use> element and append it as non-exposed tree fragment to the <use> element _excluding_ any SMIL elements. We don't actually clone the animation* elements that may be present as children of the referenced element.
> 
> Instead we're detecting all instances of the <path> element, and animate them individually when an animation is running.
> 
> I have been tricked myself often when dealing with <use> event handling - it's not immediately obvious how it works together with SMIL animation.
> 
> Still I think the bug is invalid.

My reading of http://www.w3.org/TR/SVG/struct.html#UseElement goes like this:


Quoting from the spec:
"The effect of a ‘use’ element is as if the contents of the referenced element were deeply cloned into a separate non-exposed DOM tree which had the ‘use’ element as its parent and all of the ‘use’ element's ancestors as its higher-level ancestors."

The whole contents  of the referenced element are cloned into the deep-copy, including all sub-elements and attributes. There's no allowance mentioned for leaving anything out, such as SMIL. The SMIL elements are part of the SVG document model so they must be copied as well.

>From the spec:
"The event's target and currentTarget attributes are set to the SVGElementInstance that corresponds to the target and current target elements in the referenced subtree"

This is about event handling for the cloned tree, the "non-exposed tree". The SVGElementInstance is the instance in the non-exposed tree. Events raised in the context of the cloned instance are targetted at the cloned instance (SVGElementInstance) and therefore are not targeted at the referenced tree.

In my example SVG the mouseover event for a coloured circle must be targeted at the cloned elements and the SMIL object must be in the cloned element tree. Therefore that coloured circle should animate and the referenced object shouldn't.

However, for a mouseover event on the black circle. From the spec:
"Animations on a referenced element will cause the instances to also be animated."

So, if you trigger an animation on the referenced element, that is the situation when all cloned elements should animate.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list