[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:07:46 PDT 2012


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





--- Comment #8 from Nikolas Zimmermann <zimmermann at kde.org>  2012-03-23 06:07:46 PST ---
(In reply to comment #7)
> Thank you for getting back to me, Nikolas,
> 
> Unfortunately Webkit and FF are doing this different, which is a big concern. You said:
Your example works the same in Opera & FF and WebKit, when hovering over a colored shape?
Can you summarize what we do differently than others? Is the black circle handling different?

> The spec states that:
> "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"
> 
> My point is that because <use> does a "deep clone" of the referenced element, that means that the animateTransform is also copied and since the begin and end attributes of those copies do not reference an ID explicitly, those copied animateTransforms animate each cloned non-exposed DOM tree separately.
It only states that the effect is-as it was deep cloned, there's no assumption that the actual implementation has to deep clone.

> So, mouseover on the cloned element causes an event which bubbles up through the cloned tree and on through the parents. Since a referenced element cannot have a clone of itself as a child element, the event doesn't go anywhere near the referenced element. The only animateTransform that can pick up the event is the one in the non-exposed DOM tree - i.e. the cloned animateTransform. This means that the cloned path should animate and nothing else.
Be careful here: the <use> element and its non-exposed "shadow tree" never receive events on their own. The events are dispatched to the SVGElementInstances, corresponding to the non-exposed elements in the shadow tree ("shadow tree" is our WebKit term, for naming non-exposed trees).

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.

> mouseover happens to the cloned elements - like you say it is analogous to setting a property. Using your analogy, it's like setting the fill colour on a <use> element as per my SVG example - you wouldn't expect everything including the referenced object to change colour. Yet that is what is happening with animation.
Exactly, that's why I'm suggesting to attach the animation to the <use> element, not its target. Otherwise you're listening to any click of any of the instances, and each would trigger the animation, which is not what you want.

-- 
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