[Webkit-unassigned] [Bug 16445] New: Refactor EventTargetNode & JSEventTargetNode for an upcoming SVG patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Dec 14 17:45:17 PST 2007


http://bugs.webkit.org/show_bug.cgi?id=16445

           Summary: Refactor EventTargetNode & JSEventTargetNode for an
                    upcoming SVG patch
           Product: WebKit
           Version: 525+ (Nightly build)
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: SVG
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: zimmermann at kde.org


To fix bug 15413 (SVGElementInstance does not implement EventTarget) we need to
introduce a new class called EventTargetSVGElementInstance inheriting from
EventTarget & SVGElementInstance - just like EventTargetNode works.

Some information regarding SVGElementInstance & EventTarget:
SVG spec defines how event handling works for <use> elements and their
corresponding SVGElementInstance objects - in particular it says that
SVGElementInstance and the element it references share an event listener list.
In our SVG implementation SVGElementInstance contains a pointer to the original
referenced element as well as it's corresponding shadow tree element. The goal
is that SVGUseElement now creates EventTargetSVGElementInstance objects instead
of pure SVGElementInstance objects and installs any event listeners added
through markup and/or JS on the shadow tree element! This way we can share code
using EventTargetNode, as the only difference for EventTargetSVGElementInstance
is the origin where it stores it's event listeners.

Example: <defs><rect id="rect"../> <use xlink:href="url(#rect)" id="test"/>
useElement = document.getElementById("test");
rectElement = document.getElementById("rect");

Case #1: someUseElement.instanceRoot.addEventListener(...)
calls 'addEventListener' on the 'EventTargetSVGElementInstance' object - which
in turn install an event listener on the shadow tree element.

Case #2:  rectElement.addEventListener(...)
calls 'addEventListener ' on the 'EventTargetNode' object. Altering the event
listeners will result in an update of the SVGElementInstances which belong to
the 'rectElement' - this will reclone the shadow tree elements -> this way
everything stays synchronized.

As it's possible to share a lot of code with the new
(JS)EventTargetSVGElementInstance classes - I refactored the EventTargetNode &
JSEventTargetNode class into base classes. JSEventTargetNode now forwards most
calls to EventTargetNode - same for JSEventTargetSVGElementInstance.

This patch only contains the refactorization of the EventTargetNode classes -
no SVG stuff contained here.


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list