SVGElementInstance should have EventTarget on the prototype chain
authordominicc@chromium.org <dominicc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Aug 2012 05:12:51 +0000 (05:12 +0000)
committerdominicc@chromium.org <dominicc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Aug 2012 05:12:51 +0000 (05:12 +0000)
commitd3e21ef03f99fe0f4811010a24afffd5d9937514
tree91a99c3bd5ec5f70ec9625f9989b93e0af96a11e
parent82111435b94e9312218087a3b4299a39aaaf77fe
SVGElementInstance should have EventTarget on the prototype chain
https://bugs.webkit.org/show_bug.cgi?id=88232

Reviewed by Adam Barth.

SVG 1.1 specifies that SVGElementInstance has EventTarget as its
parent interface:
<http://www.w3.org/TR/SVG/struct.html#InterfaceSVGElementInstance>
Match the spec by putting EventTarget on the prototype chain of
SVGElementInstance instead of redundantly declaring
addEventListener, removeEventListener and dispatchEvent on the
SVGElementInstance interface. This is an incremental step to make
all EventTargets do it this way, being tracked in bug 67312.

Covered by existing tests, eg
svg/custom/use-instanceRoot-as-event-target.xhtml

* CMakeLists.txt: Finding base interface types requires
searching directories with the IDLs of base interfaces.
* DerivedSources.cpp: Add generated JSEventTarget.cpp.
* DerivedSources.make: (Search paths again -- see CMakeLists.txt)
* DerivedSources.pri: "
* bindings/js/JSEventTargetCustom.cpp:
(WebCore::toEventTarget): Try to unwrap EventTargets simply as
EventTargets. When all EventTargets do this consistently this
function will be simplified.
* bindings/js/JSSVGElementInstanceCustom.cpp:
(WebCore::JSSVGElementInstance::visitChildren): SVGElementInstance
skips walking its event listener list because it forwards
listeners to its corresponding element.
* bindings/scripts/CodeGenerator.pm:
(IsStrictSubtype): For finding what is an EventTarget based on
parent interface.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader): Extend the heuristic for what is an
EventTarget. When all EventTargets are handled consistently this
will be simplified.
(GenerateImplementation):
* bindings/scripts/CodeGeneratorV8.pm: Extend the heuristic for
what is an EventTarget, and remove some of the special-casing for
EventTarget.
(GenerateHeader):
(GetInternalFields):
(GenerateImplementation):
(BaseInterfaceName):
(GenerateToV8Converters):
(GetNativeType):
(JSValueToNative):
(GetV8HeaderName):
* bindings/scripts/test/V8/V8Float64Array.cpp:
(WebCore::V8Float64Array::wrapSlow): Add assertions.
* bindings/scripts/test/V8/V8TestNode.cpp:
(WebCore::V8TestNode::wrapSlow):
* svg/SVGElementInstance.h: Must extend EventTarget first so that
static_cast<EventTarget*>(elementInstance) is the same pointer as
elementInstance, similar to how static_cast<Node*>(element) is the
same pointer as element.
* svg/SVGElementInstance.idl: Extend EventTarget; no longer need
to declare add/removeEventListener and dispatchEvent.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125251 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/DerivedSources.pri
Source/WebCore/bindings/js/JSEventTargetCustom.cpp
Source/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
Source/WebCore/svg/SVGElementInstance.h
Source/WebCore/svg/SVGElementInstance.idl