USE elements

How USE tags work in the SVG engine.

Whenever a USE tag is encountered during traverse we build a shadow tree under the use tag. This shadow tree consists of Markup::SVGE_SHADOW nodes (value 200) and has no state except for a single pointer to a HTML_Element that is a real element (not shadow) in the document tree. This makes it possible to traverse USE like any other container node if we follow that pointer everywhere where we need to read attributes.

Since we now potentially have pointers to two elements I've renamed them "layouted_elm" and "traversed_elm". In a simple document these always point to the same element, but in case of traversal into a shadow node we get the shadow node in traversed_elm and the "real" node in layout_elm.

The shadow node should contain all state depending on the position in the document (dirty rects and such) while the layouted element has all information about the state of the source code (and animations?).

The pointer from shadow->real is fragile and to avoid crashes we delete all shadow nodes whenever we're informed of a dom change (this has room for improvement with generation counters and informational flags).

Event traverse through shadow nodes as if they were regular nodes but when they look for an event target they get the event target for the real node via a new method in SVGManager.

DOM support is implemented by inheriting from DOM_Node and then hiding all normal DOM_Node methods. It's important to be a DOM_Node in C++ for events to work.

Regressions will occur. It's easy to use the wrong pointer and probably there's been some other changes that will trigger errors, but I know of none as of yet. I expect bug reports to start pouring in now.

Care must be taken when animating documents with use elements. No tree instanciated by a use-element should ever be traversed looking for animation elements. This is to make sure that each animation is just applied once but still current for all instanciated trees.