Diff
Modified: trunk/Source/WebCore/ChangeLog (108668 => 108669)
--- trunk/Source/WebCore/ChangeLog 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/ChangeLog 2012-02-23 21:23:11 UTC (rev 108669)
@@ -1,3 +1,32 @@
+2012-02-23 Erik Arvidsson <[email protected]>
+
+ Add support for InterfaceName in the bindings
+ https://bugs.webkit.org/show_bug.cgi?id=79384
+
+ Reviewed by Adam Barth.
+
+ This makes the interface name part of the idl file instead of being hard coded into the code generators.
+
+ * bindings/scripts/CodeGenerator.pm:
+ (GetVisibleInterfaceName): Extracted from CodeGenerator{JS,V8}.pm and changed to look at the extended attribute.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+ (GenerateConstructorDefinition):
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateImplementation):
+ * bindings/scripts/IDLAttributes.txt:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore):
+ * bindings/scripts/test/TestObj.idl:
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::ConfigureV8TestObjTemplate):
+ * dom/DOMCoreException.idl: Set the InterfaceName.
+ * html/DOMFormData.idl: Ditto.
+ * plugins/DOMMimeType.idl: Ditto.
+ * plugins/DOMMimeTypeArray.idl: Ditto.
+ * plugins/DOMPlugin.idl: Ditto.
+ * plugins/DOMPluginArray.idl: Ditto.
+
2012-02-22 Ryosuke Niwa <[email protected]>
REGRESSION(r99076): WebKit pastes the trailing newline into a single-line text field
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (108668 => 108669)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2012-02-23 21:23:11 UTC (rev 108669)
@@ -653,4 +653,14 @@
return grep { $_ eq $keyword } @callWithKeywords;
}
+# FIXME: This is backwards. We currently name the interface and the IDL files with the implementation name. We
+# should use the real interface name in the IDL files and then use ImplementedAs to map this to the implementation name.
+sub GetVisibleInterfaceName
+{
+ my $object = shift;
+ my $dataNode = shift;
+ my $interfaceName = $dataNode->extendedAttributes->{"InterfaceName"};
+ return $interfaceName ? $interfaceName : $dataNode->name;
+}
+
1;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (108668 => 108669)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-02-23 21:23:11 UTC (rev 108669)
@@ -189,20 +189,6 @@
return "JS" . $codeGenerator->StripModule($dataNode->parents(0));
}
-sub GetVisibleClassName
-{
- my $className = shift;
-
- return "DOMException" if $className eq "DOMCoreException";
- return "FormData" if $className eq "DOMFormData";
- return "MimeType" if $className eq "DOMMimeType";
- return "MimeTypeArray" if $className eq "DOMMimeTypeArray";
- return "Plugin" if $className eq "DOMPlugin";
- return "PluginArray" if $className eq "DOMPluginArray";
-
- return $className;
-}
-
sub GetCallbackClassName
{
my $className = shift;
@@ -1323,7 +1309,7 @@
my $hasRealParent = @{$dataNode->parents} > 0;
my $hasParent = $hasLegacyParent || $hasRealParent;
my $parentClassName = GetParentClassName($dataNode);
- my $visibleClassName = GetVisibleClassName($interfaceName);
+ my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($dataNode);
my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"};
my $needsMarkChildren = $dataNode->extendedAttributes->{"JSCustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"};
@@ -1412,7 +1398,7 @@
push(@implContent, $codeGenerator->GenerateCompileTimeCheckForEnumsIfNeeded($dataNode));
my $protoClassName = "${className}Prototype";
- GenerateConstructorDefinition(\@implContent, $className, $protoClassName, $interfaceName, $visibleClassName, $dataNode);
+ GenerateConstructorDefinition(\@implContent, $className, $protoClassName, $interfaceName, $visibleInterfaceName, $dataNode);
if ($dataNode->extendedAttributes->{"NamedConstructor"}) {
GenerateConstructorDefinition(\@implContent, $className, $protoClassName, $interfaceName, $dataNode->extendedAttributes->{"NamedConstructor"}, $dataNode, "GeneratingNamedConstructor");
}
@@ -1478,9 +1464,9 @@
push(@implContent, "{\n");
push(@implContent, " return getHashTableForGlobalData(exec->globalData(), &${className}PrototypeTable);\n");
push(@implContent, "}\n\n");
- push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", &Base::s_info, 0, get${className}PrototypeTable, CREATE_METHOD_TABLE(${className}Prototype) };\n\n");
+ push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleInterfaceName}Prototype\", &Base::s_info, 0, get${className}PrototypeTable, CREATE_METHOD_TABLE(${className}Prototype) };\n\n");
} else {
- push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", &Base::s_info, &${className}PrototypeTable, 0, CREATE_METHOD_TABLE(${className}Prototype) };\n\n");
+ push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleInterfaceName}Prototype\", &Base::s_info, &${className}PrototypeTable, 0, CREATE_METHOD_TABLE(${className}Prototype) };\n\n");
}
if ($interfaceName ne "DOMWindow" && !$dataNode->extendedAttributes->{"IsWorkerContext"}) {
push(@implContent, "JSObject* ${className}Prototype::self(ExecState* exec, JSGlobalObject* globalObject)\n");
@@ -1539,7 +1525,7 @@
push(@implContent, "}\n\n");
}
- push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleClassName}\", &Base::s_info, ");
+ push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleInterfaceName}\", &Base::s_info, ");
if ($numAttributes > 0 && !$dataNode->extendedAttributes->{"JSNoStaticTables"}) {
push(@implContent, "&${className}Table");
@@ -3373,7 +3359,7 @@
my $className = shift;
my $protoClassName = shift;
my $interfaceName = shift;
- my $visibleClassName = shift;
+ my $visibleInterfaceName = shift;
my $dataNode = shift;
my $generatingNamedConstructor = shift;
@@ -3388,13 +3374,13 @@
}
if ($generatingNamedConstructor) {
- push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", &Base::s_info, 0, 0, CREATE_METHOD_TABLE($constructorClassName) };\n\n");
+ push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleInterfaceName}Constructor\", &Base::s_info, 0, 0, CREATE_METHOD_TABLE($constructorClassName) };\n\n");
push(@$outputArray, "${constructorClassName}::${constructorClassName}(Structure* structure, JSDOMGlobalObject* globalObject)\n");
push(@$outputArray, " : DOMConstructorWithDocument(structure, globalObject)\n");
push(@$outputArray, "{\n");
push(@$outputArray, "}\n\n");
} else {
- push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", &Base::s_info, &${constructorClassName}Table, 0, CREATE_METHOD_TABLE($constructorClassName) };\n\n");
+ push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleInterfaceName}Constructor\", &Base::s_info, &${constructorClassName}Table, 0, CREATE_METHOD_TABLE($constructorClassName) };\n\n");
push(@$outputArray, "${constructorClassName}::${constructorClassName}(Structure* structure, JSDOMGlobalObject* globalObject)\n");
push(@$outputArray, " : DOMConstructorObject(structure, globalObject)\n");
push(@$outputArray, "{\n");
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (108668 => 108669)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-02-23 21:23:11 UTC (rev 108669)
@@ -2224,7 +2224,7 @@
my $object = shift;
my $dataNode = shift;
my $interfaceName = $dataNode->name;
- my $visibleInterfaceName = GetVisibleInterfaceName($interfaceName);
+ my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($dataNode);
my $className = "V8$interfaceName";
my $implClassName = $interfaceName;
@@ -3783,15 +3783,6 @@
@headerContent = ();
}
-sub GetVisibleInterfaceName
-{
- my $interfaceName = shift;
-
- return "DOMException" if $interfaceName eq "DOMCoreException";
- return "FormData" if $interfaceName eq "DOMFormData";
- return $interfaceName;
-}
-
sub GetCallbackClassName
{
my $interfaceName = shift;
Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (108668 => 108669)
--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2012-02-23 21:23:11 UTC (rev 108669)
@@ -54,6 +54,7 @@
Immutable
ImplementedAs=*
IndexedGetter
+InterfaceName=*
InitializedByEventConstructor
IsIndex
IsWorkerContext
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (108668 => 108669)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2012-02-23 21:23:11 UTC (rev 108669)
@@ -187,7 +187,7 @@
COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDoNotCheckConstants);
COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDoNotCheckConstants);
-const ClassInfo JSTestObjConstructor::s_info = { "TestObjConstructor", &Base::s_info, &JSTestObjConstructorTable, 0, CREATE_METHOD_TABLE(JSTestObjConstructor) };
+const ClassInfo JSTestObjConstructor::s_info = { "TestObjectConstructor", &Base::s_info, &JSTestObjConstructorTable, 0, CREATE_METHOD_TABLE(JSTestObjConstructor) };
JSTestObjConstructor::JSTestObjConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(structure, globalObject)
@@ -302,7 +302,7 @@
};
static const HashTable JSTestObjPrototypeTable = { 266, 255, JSTestObjPrototypeTableValues, 0 };
-const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", &Base::s_info, &JSTestObjPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestObjPrototype) };
+const ClassInfo JSTestObjPrototype::s_info = { "TestObjectPrototype", &Base::s_info, &JSTestObjPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestObjPrototype) };
JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
{
@@ -321,7 +321,7 @@
return getStaticPropertyDescriptor<JSTestObjPrototype, JSObject>(exec, &JSTestObjPrototypeTable, thisObject, propertyName, descriptor);
}
-const ClassInfo JSTestObj::s_info = { "TestObj", &Base::s_info, &JSTestObjTable, 0 , CREATE_METHOD_TABLE(JSTestObj) };
+const ClassInfo JSTestObj::s_info = { "TestObject", &Base::s_info, &JSTestObjTable, 0 , CREATE_METHOD_TABLE(JSTestObj) };
JSTestObj::JSTestObj(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestObj> impl)
: JSDOMWrapper(structure, globalObject)
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (108668 => 108669)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2012-02-23 21:23:11 UTC (rev 108669)
@@ -31,7 +31,8 @@
// changes in its ouput.
module test {
interface [
- Constructor
+ Constructor,
+ InterfaceName=TestObject
] TestObj {
// Attributes
readonly attribute long readOnlyIntAttr;
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (108668 => 108669)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-02-23 21:23:11 UTC (rev 108669)
@@ -1963,7 +1963,7 @@
desc->ReadOnlyPrototype();
v8::Local<v8::Signature> defaultSignature;
- defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
+ defaultSignature = configureTemplate(desc, "TestObject", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs),
TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks));
UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
Modified: trunk/Source/WebCore/dom/DOMCoreException.idl (108668 => 108669)
--- trunk/Source/WebCore/dom/DOMCoreException.idl 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/dom/DOMCoreException.idl 2012-02-23 21:23:11 UTC (rev 108669)
@@ -30,7 +30,8 @@
interface [
JSNoStaticTables,
- DoNotCheckConstants
+ DoNotCheckConstants,
+ InterfaceName=DOMException
] DOMCoreException {
readonly attribute unsigned short code;
Modified: trunk/Source/WebCore/html/DOMFormData.idl (108668 => 108669)
--- trunk/Source/WebCore/html/DOMFormData.idl 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/html/DOMFormData.idl 2012-02-23 21:23:11 UTC (rev 108669)
@@ -33,7 +33,8 @@
interface [
CustomConstructor,
JSGenerateToNativeObject,
- JSGenerateToJSObject
+ JSGenerateToJSObject,
+ InterfaceName=FormData
] DOMFormData {
// void append(DOMString name, DOMString value);
// void append(DOMString name, Blob value, optional DOMString filename);
Modified: trunk/Source/WebCore/plugins/DOMMimeType.idl (108668 => 108669)
--- trunk/Source/WebCore/plugins/DOMMimeType.idl 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/plugins/DOMMimeType.idl 2012-02-23 21:23:11 UTC (rev 108669)
@@ -20,7 +20,9 @@
module window {
- interface DOMMimeType {
+ interface [
+ InterfaceName=MimeType
+ ] DOMMimeType {
readonly attribute DOMString type;
readonly attribute DOMString suffixes;
readonly attribute DOMString description;
Modified: trunk/Source/WebCore/plugins/DOMMimeTypeArray.idl (108668 => 108669)
--- trunk/Source/WebCore/plugins/DOMMimeTypeArray.idl 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/plugins/DOMMimeTypeArray.idl 2012-02-23 21:23:11 UTC (rev 108669)
@@ -23,7 +23,8 @@
interface [
JSGenerateIsReachable=ImplFrame,
NamedGetter,
- IndexedGetter
+ IndexedGetter,
+ InterfaceName=MimeTypeArray
] DOMMimeTypeArray {
readonly attribute unsigned long length;
DOMMimeType item(in [Optional=DefaultIsUndefined] unsigned long index);
Modified: trunk/Source/WebCore/plugins/DOMPlugin.idl (108668 => 108669)
--- trunk/Source/WebCore/plugins/DOMPlugin.idl 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/plugins/DOMPlugin.idl 2012-02-23 21:23:11 UTC (rev 108669)
@@ -22,7 +22,8 @@
interface [
NamedGetter,
- IndexedGetter
+ IndexedGetter,
+ InterfaceName=Plugin
] DOMPlugin {
readonly attribute DOMString name;
readonly attribute DOMString filename;
Modified: trunk/Source/WebCore/plugins/DOMPluginArray.idl (108668 => 108669)
--- trunk/Source/WebCore/plugins/DOMPluginArray.idl 2012-02-23 21:17:27 UTC (rev 108668)
+++ trunk/Source/WebCore/plugins/DOMPluginArray.idl 2012-02-23 21:23:11 UTC (rev 108669)
@@ -23,7 +23,8 @@
interface [
JSGenerateIsReachable=ImplFrame,
NamedGetter,
- IndexedGetter
+ IndexedGetter,
+ InterfaceName=PluginArray
] DOMPluginArray {
readonly attribute unsigned long length;
DOMPlugin item(in [Optional=DefaultIsUndefined] unsigned long index);