angler-fishThe Vulnerability History Project

2010-01-18 Nikolas Zimmermann <nzimmermann@rim.com>

      Reviewed by Dirk Schulze.

        Rewrite SVG <use> support in a modern-fashion
        https://bugs.webkit.org/show_bug.cgi?id=33776

        Tests: svg/custom/relative-sized-deep-shadow-tree-content.xhtml
               svg/custom/relative-sized-shadow-tree-content.xhtml

        Fixes: svg/W3C-SVG-1.1/animate-elem-30-t.svg (animated circle sometimes takes wrong path)

        Rewrite <use> support in less intrusive way. Try hard to avoid recloning where possible, and do it lazily.
        Introduce RenderSVGShadowTreeRootContainer as special renderer for SVGUseElement, that now manages the
        render tree, instead of SVGUseElement manually hacking around it's own renderer from the DOM side.

        Instead of recloning the whole shadow tree for every attribute change (DOM setAttribute / SVG DOM changes / CSS changes / childrenChanged()...)
        just notify the RenderSVGShadowTreeRootContainer that it's supposed to reclone the tree upon the next updateFromElement() call.

        updateFromElement() is fired from SVGUseElement::attach() / recalcStyle(), as it's done for HTMLFormControlElement/HTMLMediaElement, thus
        lazily recloning the shadow tree if necessary.

        Animations for <use> elements was a real performance bottlenck as the tree got recloned on every attribute change. Reclones are _completly_
        avoided for animations now - the SVGAnim*Element classes already updated the instances of an element manually, though that resulted in a reclone
        nontheless, and thus killing performance. <use> elements can only be recloned through mutations of the elements that they reference to.
        For example referencing a <rect> element from a <use> element and scripting the <rect> element (setAttribute, or child tree mutations etc.).
        We reclone instead of trying to synchronize trees - as it's currenty implemented - because it's very hard to do it right.

        Any D
    
commit fa259feb4d777f02f27a9a3e52f4a5646815ca6d
-31
+2 -2
-1
-21
-1
-25
-1
+1 -1
+2 -2
+3 -3
-1
-2
-1
-2
-2
-1
+1 -1
-24
-26
+3 -10
+1 -3
-105
-4
-4
+1 -5
-16
-16
-101
-50
+3 -11
-80
-67
+2 -5
+8 -1
+32 -10
+6
-1
+15 -2
+4 -5
+178 -207
+12 -16
expand_less