-
zimmermann@webkit.org authored
Fixes: https://bugs.webkit.org/show_bug.cgi?id=15413 (SVGElementInstance does not implement EventTarget) Fixes: https://bugs.webkit.org/show_bug.cgi?id=15430 (SVGElementInstances should rebuild themselves lazily) Fixes: https://bugs.webkit.org/show_bug.cgi?id=20550 (SVGUseElement.setAttribute crashes Safari) Rebuild SVG use element shadow tree lazily. Mark SVGElementInstance with the "needsUpdate" flag. Next time SVGUseElement::recalcStyle is invoked (ie. via Document::updateDocumentsRendering()) the use tree is rebuild. Make SVGElementInstance a real EventTarget, as the SVG specification demands. When dispatching events to a shadow tree element of a use element, the associated SVGElementInstance is used as event target. The SVGElementInstance, the shadow tree element and the corresponding element share an event listener list. Every event listener change on the SVGElementInstance object is forwared to the corresponding element. Each change marks the SVGElementInstance tree dirty, and causes a reclone. Each event listener defined via attributes (onclick/onkeydown/...) is copied from the correspondingElement to the shadow tree element - through the cloneNode calls - if the use element's shadow tree gets rebuild. Each listener, dynamically created using addEventListener, gets copied to the corersponding element as well. Now that the target/currentTarget properties of the Events are correct, event bubbling works as expected, see resources/use-instanceRoot-event-bubbling.js for details. Tests: svg/custom/use-elementInstance-event-target.svg (reenabled) svg/custom/use-elementInstance-methods.svg (reenabled) svg/custom/use-setAttribute-crash.svg (covers bug 20550) svg/custom/use-instanceRoot-as-event-target.xhtml (covers bug 15413) svg/custom/use-instanceRoot-event-bubbling.xhtml (covers bug 15413) svg/custom/use-instanceRoot-event-listeners.xhtml (covers bug 15413 & 15430) git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37435 268f45cc-cd09-0410-ab3c-d52691b4dbfc
abd88452