[Webkit-unassigned] [Bug 41421] Node.cloneNode does not work on SVG nodes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jul 3 00:45:10 PDT 2010


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





--- Comment #10 from Nikolas Zimmermann <zimmermann at kde.org>  2010-07-03 00:45:10 PST ---
(In reply to comment #9)
> N(In reply to comment #8)
> > (In reply to comment #7)
> > > If you grep for "updateAnimatedSVGAttribute" in WebCore/dom, you should see how it works, and how to hook that logic into cloneNode. Do you want to give it a try?
> > 
> > Niko, the way this should work is that Element::cloneElementWithoutChildren calls attributes(true), then Element::attributes calls updateAnimatedSVGAttribute. Why isn’t that working?
> 
> Didn't investigate yet. I only know a workaround, that proves it's related to the synchronization:
> If you insert " alert(ellipse1.getAttribute("cx"));" before cloning the ellipse, it works as expected.
> 
> I'll check soon what's going on.

That was easy:

PassRefPtr<Element> Element::cloneElementWithoutChildren()
{
...

    if (namedAttrMap)
        clone->attributes()->setAttributes(*attributes(true)); // Call attributes(true) to force attribute synchronization to occur (for svg and style) before cloning happens.
...
}

The synchronization only happens if namedAttrMap is not null. In this case, as no XML attributes have been specified, the namedAttrMap is null, and thus synchronization does not happen.
A possible fix would be to add following...

#if ENABLE(SVG)
    if (!areSVGAttributesValid())
        updateAnimatedSVGAttribute(anyQName());
#endif

... before checking whether namedAttrMap exists. This is the same check done in attributes(), see Element.h.

What do you think? Shall I prepare a patch?

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