Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (125250 => 125251)
--- trunk/Source/WebCore/CMakeLists.txt 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-08-10 05:12:51 UTC (rev 125251)
@@ -107,11 +107,17 @@
)
SET(WebCore_IDL_INCLUDES
+ Modules/battery
Modules/filesystem
Modules/gamepad
Modules/geolocation
Modules/indexeddb
+ Modules/intents
+ Modules/mediastream
+ Modules/networkinfo
Modules/quota
+ Modules/speech
+ Modules/vibration
Modules/webaudio
Modules/webdatabase
Modules/websockets
@@ -121,8 +127,11 @@
fileapi
html
html/canvas
+ html/shadow
+ html/track
inspector
loader/appcache
+ notifications
page
plugins
storage
Modified: trunk/Source/WebCore/ChangeLog (125250 => 125251)
--- trunk/Source/WebCore/ChangeLog 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/ChangeLog 2012-08-10 05:12:51 UTC (rev 125251)
@@ -1,3 +1,65 @@
+2012-08-02 Dominic Cooney <[email protected]>
+
+ 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.
+
2012-08-09 Vivek Galatage <[email protected]>
Web Inspector: Remove unused method InspectorResourceAgent::clearCache from Resource Agent.
Modified: trunk/Source/WebCore/DerivedSources.cpp (125250 => 125251)
--- trunk/Source/WebCore/DerivedSources.cpp 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/DerivedSources.cpp 2012-08-10 05:12:51 UTC (rev 125251)
@@ -116,6 +116,7 @@
#include "JSEvent.cpp"
#include "JSEventException.cpp"
#include "JSEventSource.cpp"
+#include "JSEventTarget.cpp"
#include "JSFile.cpp"
#include "JSFileCallback.cpp"
#include "JSFileEntry.cpp"
Modified: trunk/Source/WebCore/DerivedSources.make (125250 => 125251)
--- trunk/Source/WebCore/DerivedSources.make 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/DerivedSources.make 2012-08-10 05:12:51 UTC (rev 125251)
@@ -957,15 +957,36 @@
# JS bindings generator
IDL_INCLUDES = \
+ $(WebCore)/Modules/battery \
+ $(WebCore)/Modules/filesystem \
+ $(WebCore)/Modules/gamepad \
+ $(WebCore)/Modules/geolocation \
+ $(WebCore)/Modules/indexeddb \
+ $(WebCore)/Modules/intents \
+ $(WebCore)/Modules/mediasource \
+ $(WebCore)/Modules/mediastream \
+ $(WebCore)/Modules/networkinfo \
+ $(WebCore)/Modules/notifications \
+ $(WebCore)/Modules/speech \
+ $(WebCore)/Modules/vibration \
+ $(WebCore)/Modules/webaudio \
+ $(WebCore)/Modules/webdatabase \
+ $(WebCore)/Modules/websockets \
+ $(WebCore)/css \
$(WebCore)/dom \
$(WebCore)/fileapi \
$(WebCore)/html \
- $(WebCore)/css \
- $(WebCore)/Modules/mediasource \
- $(WebCore)/Modules/notifications \
+ $(WebCore)/html/canvas \
+ $(WebCore)/html/shadow \
+ $(WebCore)/html/track \
+ $(WebCore)/inspector \
+ $(WebCore)/loader/appcache \
$(WebCore)/page \
- $(WebCore)/xml \
- $(WebCore)/svg
+ $(WebCore)/plugins \
+ $(WebCore)/storage \
+ $(WebCore)/svg \
+ $(WebCore)/workers \
+ $(WebCore)/xml
IDL_COMMON_ARGS = $(IDL_INCLUDES:%=--include %) --write-dependencies --outputDir .
Modified: trunk/Source/WebCore/DerivedSources.pri (125250 => 125251)
--- trunk/Source/WebCore/DerivedSources.pri 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/DerivedSources.pri 2012-08-10 05:12:51 UTC (rev 125251)
@@ -714,19 +714,30 @@
--include $$PWD/Modules/filesystem \
--include $$PWD/Modules/geolocation \
--include $$PWD/Modules/indexeddb \
+ --include $$PWD/Modules/mediasource \
+ --include $$PWD/Modules/notifications \
--include $$PWD/Modules/quota \
--include $$PWD/Modules/webaudio \
--include $$PWD/Modules/webdatabase \
--include $$PWD/Modules/websockets \
+ --include $$PWD/css \
--include $$PWD/dom \
+ --include $$PWD/editing \
--include $$PWD/fileapi \
--include $$PWD/html \
- --include $$PWD/xml \
+ --include $$PWD/html/canvas \
+ --include $$PWD/html/shadow \
+ --include $$PWD/html/track \
+ --include $$PWD/inspector \
+ --include $$PWD/loader/appcache \
+ --include $$PWD/page \
+ --include $$PWD/plugins \
+ --include $$PWD/storage \
--include $$PWD/svg \
- --include $$PWD/storage \
- --include $$PWD/css \
--include $$PWD/testing \
+ --include $$PWD/websockets \
--include $$PWD/workers \
+ --include $$PWD/xml \
--outputDir ${QMAKE_FUNC_FILE_OUT_PATH} \
--supplementalDependencyFile ${QMAKE_FUNC_FILE_OUT_PATH}/$$SUPPLEMENTAL_DEPENDENCY_FILE \
--preprocessor \"$${QMAKE_MOC} -E\" ${QMAKE_FILE_NAME}
Modified: trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp (125250 => 125251)
--- trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp 2012-08-10 05:12:51 UTC (rev 125251)
@@ -73,6 +73,8 @@
if (value.inherits(&JSDOMWindowShell::s_info))
return jsCast<JSDOMWindowShell*>(asObject(value))->impl();
+ TRY_TO_UNWRAP_WITH_INTERFACE(EventTarget)
+ // FIXME: Remove this once all event targets extend EventTarget
DOM_EVENT_TARGET_INTERFACES_FOR_EACH(TRY_TO_UNWRAP_WITH_INTERFACE)
return 0;
}
Modified: trunk/Source/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp (125250 => 125251)
--- trunk/Source/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp 2012-08-10 05:12:51 UTC (rev 125251)
@@ -30,8 +30,7 @@
#include "JSSVGElementInstance.h"
-#include "JSNode.h"
-#include "SVGElementInstance.h"
+#include "JSEventTarget.h"
namespace WebCore {
@@ -41,7 +40,9 @@
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
COMPILE_ASSERT(StructureFlags & JSC::OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
- Base::visitChildren(thisObject, visitor);
+ // Skip JSEventTarget::visitChildren because event listener registration is
+ // forwarded to the corresponding element.
+ JSEventTarget::Base::visitChildren(thisObject, visitor);
visitor.addOpaqueRoot(root(thisObject->impl()->correspondingElement()));
}
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (125250 => 125251)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2012-08-10 05:12:51 UTC (rev 125251)
@@ -708,4 +708,22 @@
return $interfaceName ? $interfaceName : $dataNode->name;
}
+sub IsStrictSubtype
+{
+ my $object = shift;
+ my $dataNode = shift;
+ my $interfaceName = shift;
+ my $found = 0;
+
+ $object->ForAllParents($dataNode, sub {
+ my $interface = shift;
+ if ($object->StripModule($interface->name) eq $interfaceName) {
+ $found = 1;
+ }
+ return "prune" if $found;
+ }, 0, 1);
+
+ return $found;
+}
+
1;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (125250 => 125251)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-08-10 05:12:51 UTC (rev 125251)
@@ -678,8 +678,7 @@
my $hasRealParent = @{$dataNode->parents} > 0;
my $hasParent = $hasLegacyParent || $hasRealParent;
my $parentClassName = GetParentClassName($dataNode);
- my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"};
- my $needsMarkChildren = $dataNode->extendedAttributes->{"JSCustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"};
+ my $needsMarkChildren = $dataNode->extendedAttributes->{"JSCustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"} || $dataNode->name eq "EventTarget";
# - Add default header template and header protection
push(@headerContentHeader, GenerateHeaderContentHeader($dataNode));
@@ -1375,8 +1374,8 @@
my $hasParent = $hasLegacyParent || $hasRealParent;
my $parentClassName = GetParentClassName($dataNode);
my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($dataNode);
- my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"};
- my $needsMarkChildren = $dataNode->extendedAttributes->{"JSCustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"};
+ my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"} || $codeGenerator->IsStrictSubtype($dataNode, "EventTarget");
+ my $needsMarkChildren = $dataNode->extendedAttributes->{"JSCustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"} || $dataNode->name eq "EventTarget";
# - Add default header template
push(@implContentHeader, GenerateImplementationContentHeader($dataNode));
@@ -2275,7 +2274,7 @@
push(@implContent, " COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);\n");
push(@implContent, " ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());\n");
push(@implContent, " Base::visitChildren(thisObject, visitor);\n");
- if ($dataNode->extendedAttributes->{"EventTarget"}) {
+ if ($dataNode->extendedAttributes->{"EventTarget"} || $dataNode->name eq "EventTarget") {
push(@implContent, " thisObject->impl()->visitJSEventListeners(visitor);\n");
}
if ($numCachedAttributes > 0) {
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (125250 => 125251)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-08-10 05:12:51 UTC (rev 125251)
@@ -289,8 +289,7 @@
my $className = "V8$interfaceName";
my $implClassName = $interfaceName;
- # Copy contents of parent classes except the first parent or if it is
- # EventTarget.
+ # Copy contents of parent classes except the first parent.
$codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@allParents, 1);
$codeGenerator->LinkOverloadedFunctions($dataNode);
@@ -299,7 +298,6 @@
if (!$hasDependentLifetime) {
foreach (@{$dataNode->parents}) {
my $parent = $codeGenerator->StripModule($_);
- next if $parent eq "EventTarget";
$headerIncludes{"V8${parent}.h"} = 1;
}
}
@@ -365,7 +363,6 @@
my $separator = "";
foreach (@{$dataNode->parents}) {
my $parent = $codeGenerator->StripModule($_);
- next if $parent eq "EventTarget";
$headerIncludes{"V8${parent}.h"} = 1;
push(@headerContent, "${separator}V8${parent}::hasDependentLifetime");
$separator = " || ";
@@ -566,14 +563,12 @@
# We can't ask whether a parent type has a given extendedAttribute,
# so special-case AbstractWorker and WorkerContext to include all sub-types.
# Event listeners on DOM nodes are explicitly supported in the GC controller.
- # FIXME: SVGElementInstance should probably have the EventTarget extended attribute, but doesn't.
# FIXME: Simplify this when all EventTargets are subtypes of EventTarget.
if (!IsNodeSubType($dataNode)
&& ($dataNode->extendedAttributes->{"EventTarget"}
|| $dataNode->extendedAttributes->{"IsWorkerContext"}
|| IsSubType($dataNode, "AbstractWorker")
- || $name eq "SVGElementInstance"
- || $name eq "EventTarget")) {
+ || IsSubType($dataNode, "EventTarget"))) {
push(@customInternalFields, "eventListenerCacheIndex");
}
@@ -2561,9 +2556,6 @@
my $parentClassTemplate = "";
foreach (@{$dataNode->parents}) {
my $parent = $codeGenerator->StripModule($_);
- if ($parent eq "EventTarget") {
- next;
- }
AddToImplIncludes("V8${parent}.h");
$parentClass = "V8" . $parent;
$parentClassTemplate = $parentClass . "::GetTemplate()";
@@ -3343,6 +3335,17 @@
push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString;
}
+sub BaseInterfaceName
+{
+ my $dataNode = shift;
+
+ while (@{$dataNode->parents}) {
+ $dataNode = $codeGenerator->ParseInterface($codeGenerator->StripModule(@{$dataNode->parents}[0]), 1);
+ }
+
+ return $codeGenerator->StripModule($dataNode->name);
+}
+
sub GenerateToV8Converters
{
my $dataNode = shift;
@@ -3354,6 +3357,7 @@
my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : "";
my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : "";
my $wrapSlowArgumentType = GetPassRefPtrType($nativeType);
+ my $baseType = BaseInterfaceName($dataNode);
push(@implContent, <<END);
@@ -3361,6 +3365,11 @@
{
v8::Handle<v8::Object> wrapper;
END
+ if ($baseType ne $interfaceName) {
+ push(@implContent, <<END);
+ ASSERT(static_cast<void*>(static_cast<${baseType}*>(impl.get())) == static_cast<void*>(impl.get()));
+END
+ }
my $proxyInit;
if (IsNodeSubType($dataNode)) {
@@ -3697,6 +3706,8 @@
return "Range::CompareHow" if $type eq "CompareHow";
return "DOMTimeStamp" if $type eq "DOMTimeStamp";
return "unsigned" if $type eq "unsigned int";
+ # FIXME: When EventTarget is an interface and not a mixin, fix this so that
+ # EventTarget can be passed as a parameter.
return "Node*" if $type eq "EventTarget" and $isParameter;
return "double" if $type eq "Date";
return "ScriptValue" if $type eq "DOMObject";
@@ -3814,6 +3825,8 @@
}
# Default, assume autogenerated type conversion routines
+ # FIXME: When EventTarget is an interface and not a mixin, fix this to use
+ # V8EventTarget::HasInstance etc.
if ($type eq "EventTarget") {
AddToImplIncludes("V8Node.h");
@@ -3857,7 +3870,6 @@
my $type = shift;
return "V8Event.h" if $type eq "DOMTimeStamp";
return "EventListener.h" if $type eq "EventListener";
- return "EventTarget.h" if $type eq "EventTarget";
return "SerializedScriptValue.h" if $type eq "SerializedScriptValue";
return "ScriptValue.h" if $type eq "DOMObject";
return "V8DOMStringList.h" if $type eq "DOMString[]";
@@ -3949,6 +3961,8 @@
'Date' => 1,
'Dictionary' => 1,
'EventListener' => 1,
+ # FIXME: When EventTarget is an interface and not a mixin, fix this so that
+ # EventTarget is treated as a wrapper type.
'EventTarget' => 1,
'IDBKey' => 1,
'JSObject' => 1,
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp (125250 => 125251)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp 2012-08-10 05:12:51 UTC (rev 125251)
@@ -150,6 +150,7 @@
v8::Handle<v8::Object> V8Float64Array::wrapSlow(PassRefPtr<Float64Array> impl, v8::Isolate* isolate)
{
v8::Handle<v8::Object> wrapper;
+ ASSERT(static_cast<void*>(static_cast<ArrayBufferView*>(impl.get())) == static_cast<void*>(impl.get()));
V8Proxy* proxy = 0;
wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get());
if (UNLIKELY(wrapper.IsEmpty()))
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp (125250 => 125251)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp 2012-08-10 05:12:51 UTC (rev 125251)
@@ -113,6 +113,7 @@
v8::Handle<v8::Object> V8TestNode::wrapSlow(PassRefPtr<TestNode> impl, v8::Isolate* isolate)
{
v8::Handle<v8::Object> wrapper;
+ ASSERT(static_cast<void*>(static_cast<Node*>(impl.get())) == static_cast<void*>(impl.get()));
V8Proxy* proxy = impl->document()->frame() ? impl->document()->frame()->script()->proxy() : 0;
// Enter the node's context and create the wrapper in that context.
Modified: trunk/Source/WebCore/svg/SVGElementInstance.h (125250 => 125251)
--- trunk/Source/WebCore/svg/SVGElementInstance.h 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/svg/SVGElementInstance.h 2012-08-10 05:12:51 UTC (rev 125251)
@@ -38,7 +38,7 @@
class SVGStyledElement;
// SVGElementInstance mimics Node, but without providing all its functionality
-class SVGElementInstance : public TreeShared<SVGElementInstance, SVGElementInstance>, public EventTarget {
+class SVGElementInstance : public EventTarget, public TreeShared<SVGElementInstance, SVGElementInstance> {
public:
static PassRefPtr<SVGElementInstance> create(SVGUseElement* correspondingUseElement, SVGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement)
{
Modified: trunk/Source/WebCore/svg/SVGElementInstance.idl (125250 => 125251)
--- trunk/Source/WebCore/svg/SVGElementInstance.idl 2012-08-10 05:00:19 UTC (rev 125250)
+++ trunk/Source/WebCore/svg/SVGElementInstance.idl 2012-08-10 05:12:51 UTC (rev 125251)
@@ -29,10 +29,13 @@
interface [
Conditional=SVG,
JSCustomMarkFunction,
- JSGenerateToNativeObject
+ JSGenerateToNativeObject,
+ JSGenerateToJSObject
] SVGElementInstance
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
: Object, EventTarget
+#else
+ : EventTarget
#endif /* defined(LANGUAGE_OBJECTIVE_C) */
{
readonly attribute SVGElement correspondingElement;
@@ -86,15 +89,6 @@
attribute [NotEnumerable] EventListener onselectstart;
attribute [NotEnumerable] EventListener onsubmit;
attribute [NotEnumerable] EventListener onunload;
-
- void addEventListener(in DOMString type,
- in EventListener listener,
- in [Optional] boolean useCapture);
- void removeEventListener(in DOMString type,
- in EventListener listener,
- in [Optional] boolean useCapture);
- boolean dispatchEvent(in Event event)
- raises(EventException);
#endif /* defined(LANGUAGE_OBJECTIVE_C) */
};
}