12012-06-05 Dominic Cooney <dominicc@chromium.org>
2
3 SVGElementInstance should have EventTarget on the prototype chain
4 https://bugs.webkit.org/show_bug.cgi?id=88232
5
6 Reviewed by NOBODY (OOPS!).
7
8 SVG 1.1 specifies that SVGElementInstance has EventTarget as its
9 parent interface:
10 <http://www.w3.org/TR/SVG/struct.html#InterfaceSVGElementInstance>
11 Match the spec by putting EventTarget on the prototype chain of
12 SVGElementInstance instead of redundantly declaring
13 addEventListener, removeEventListener and dispatchEvent on the
14 SVGElementInstance interface. This is an incremental step to make
15 all EventTargets do it this way, being tracked in bug 67312.
16
17 Covered by existing tests, eg
18 svg/custom/use-instanceRoot-as-event-target.xhtml
19
20 * CMakeLists.txt: Finding base interface types requires
21 searching directories with the IDLs of base interfaces.
22 * DerivedSources.make: "
23 * bindings/js/JSEventTargetCustom.cpp:
24 (WebCore::toEventTarget): Try to unwrap EventTargets simply as
25 EventTargets. When all EventTargets do this consistently this
26 function will be simplified.
27 * bindings/js/JSSVGElementInstanceCustom.cpp:
28 (WebCore::JSSVGElementInstance::visitChildren): SVGElementInstance
29 skips walking its event listener list because it forwards
30 listeners to its corresponding element.
31 * bindings/scripts/CodeGenerator.pm:
32 (IsStrictSubtype): For finding what is an EventTarget based on
33 parent interface.
34 * bindings/scripts/CodeGeneratorJS.pm:
35 (GenerateHeader): Extend the heuristic for what is an
36 EventTarget. When all EventTargets are handled consistently this
37 will be simplified.
38 (GenerateImplementation):
39 * bindings/scripts/CodeGeneratorV8.pm: Extend the heuristic for
40 what is an EventTarget, and remove some of the special-casing for
41 EventTarget.
42 (GenerateHeader):
43 (GetInternalFields):
44 (GenerateImplementation):
45 (GetNativeType):
46 (JSValueToNative):
47 (GetV8HeaderName):
48 * svg/SVGElementInstance.h: Must extend EventTarget first so that
49 static_cast<EventTarget*>(elementInstance) is the same pointer as
50 elementInstance, similar to how static_cast<Node*>(element) is the
51 same pointer as element.
52 * svg/SVGElementInstance.idl: Extend EventTarget; no longer need
53 to declare add/removeEventListener and dispatchEvent.
54