Diff
Modified: trunk/Source/WebCore/ChangeLog (188118 => 188119)
--- trunk/Source/WebCore/ChangeLog 2015-08-07 06:48:27 UTC (rev 188118)
+++ trunk/Source/WebCore/ChangeLog 2015-08-07 08:15:13 UTC (rev 188119)
@@ -1,3 +1,28 @@
+2015-08-07 Xabier Rodriguez Calvar <[email protected]>
+
+ Create [CustomBinding] extended IDL attribute
+ https://bugs.webkit.org/show_bug.cgi?id=146593
+
+ Reviewed by Geoffrey Garen.
+
+ Added the [CustomBinding] IDL extended attribute. The idea is that when using this attribute, bindings generate
+ only the signature of the JS functions and we have to implement all the access in the Custom.cpp files, meaning
+ accessing the implementations at our wish.
+
+ Added customBindingMethod, customBindingMethodWithArgs to the generator tests.
+
+ * bindings/scripts/CodeGeneratorGObject.pm:
+ (SkipFunction): Skipped [CustomBinding] methods.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateHeader): Consider CustomBinding as ForwardDeclareInHeader.
+ (GenerateImplementation): Avoid printing both header and implementation of the function.
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ (SkipFunction): Skipped [CustomBinding] methods.
+ * bindings/scripts/IDLAttributes.txt: Added [CustomBinding] IDL extended attribute.
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/TestObj.idl: Added customBindingMethod, customBindingMethodWithArgs and their
+ expectations.
+
2015-08-06 Zan Dobersek <[email protected]>
Source/WebCore/crypto code should pass std::function<> objects through rvalue references
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm (188118 => 188119)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm 2015-08-07 06:48:27 UTC (rev 188118)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm 2015-08-07 08:15:13 UTC (rev 188119)
@@ -283,7 +283,7 @@
my $functionName = "webkit_dom_" . $decamelize . "_" . $prefix . decamelize($function->signature->name);
my $functionReturnType = $prefix eq "set_" ? "void" : $function->signature->type;
- my $isCustomFunction = $function->signature->extendedAttributes->{"Custom"};
+ my $isCustomFunction = $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"CustomBinding"};
my $callWith = $function->signature->extendedAttributes->{"CallWith"};
my $isUnsupportedCallWith = $codeGenerator->ExtendedAttributeContains($callWith, "ScriptArguments") || $codeGenerator->ExtendedAttributeContains($callWith, "CallStack");
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (188118 => 188119)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2015-08-07 06:48:27 UTC (rev 188118)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2015-08-07 08:15:13 UTC (rev 188119)
@@ -1092,7 +1092,7 @@
foreach my $function (@{$interface->functions}) {
$numCustomFunctions++ if HasCustomMethod($function->signature->extendedAttributes);
- if ($function->signature->extendedAttributes->{"ForwardDeclareInHeader"}) {
+ if ($function->signature->extendedAttributes->{"ForwardDeclareInHeader"} or $function->signature->extendedAttributes->{"CustomBinding"}) {
$hasForwardDeclaringFunctions = 1;
}
}
@@ -1225,7 +1225,7 @@
push(@headerContent,"// Functions\n\n");
foreach my $function (@{$interface->functions}) {
next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
- next unless $function->signature->extendedAttributes->{"ForwardDeclareInHeader"};
+ next unless $function->signature->extendedAttributes->{"ForwardDeclareInHeader"} or $function->signature->extendedAttributes->{"CustomBinding"};
my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
if ($needsAppleCopyright) {
@@ -1246,6 +1246,7 @@
}
push(@headerContent, $endAppleCopyright) if $inAppleCopyright;
+ push(@headerContent,"\n");
}
if ($hasForwardDeclaringAttributes) {
@@ -1743,6 +1744,7 @@
foreach my $function (@{$interface->functions}) {
next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
next if $function->signature->extendedAttributes->{"ForwardDeclareInHeader"};
+ next if $function->signature->extendedAttributes->{"CustomBinding"};
my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
if ($needsAppleCopyright) {
@@ -2760,6 +2762,7 @@
if ($numFunctions > 0) {
my $inAppleCopyright = 0;
foreach my $function (@{$interface->functions}) {
+ next if $function->signature->extendedAttributes->{"CustomBinding"};
my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
if ($needsAppleCopyright) {
if (!$inAppleCopyright) {
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (188118 => 188119)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm 2015-08-07 06:48:27 UTC (rev 188118)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm 2015-08-07 08:15:13 UTC (rev 188119)
@@ -538,6 +538,7 @@
return 1 if $codeGenerator->GetArrayType($function->signature->type);
return 1 if $function->signature->type eq "Promise";
+ return 1 if $function->signature->extendedAttributes->{"CustomBinding"};
foreach my $param (@{$function->parameters}) {
return 1 if $codeGenerator->GetSequenceType($param->type);
Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (188118 => 188119)
--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2015-08-07 06:48:27 UTC (rev 188118)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2015-08-07 08:15:13 UTC (rev 188119)
@@ -34,6 +34,7 @@
ConstructorRaisesException
ConstructorTemplate=Event|TypedArray
Custom
+CustomBinding
CustomCall
CustomConstructor
CustomDeleteProperty
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (188118 => 188119)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2015-08-07 06:48:27 UTC (rev 188118)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2015-08-07 08:15:13 UTC (rev 188119)
@@ -598,6 +598,8 @@
{ "methodWithException", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithException), (intptr_t) (0) },
{ "customMethod", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethod), (intptr_t) (0) },
{ "customMethodWithArgs", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t) (3) },
+ { "customBindingMethod", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomBindingMethod), (intptr_t) (0) },
+ { "customBindingMethodWithArgs", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomBindingMethodWithArgs), (intptr_t) (3) },
{ "addEventListener", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionAddEventListener), (intptr_t) (2) },
{ "removeEventListener", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionRemoveEventListener), (intptr_t) (2) },
{ "withScriptStateVoid", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoid), (intptr_t) (0) },
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (188118 => 188119)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2015-08-07 06:48:27 UTC (rev 188118)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2015-08-07 08:15:13 UTC (rev 188119)
@@ -101,7 +101,12 @@
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestObj*);
inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj& impl) { return toJS(exec, globalObject, &impl); }
+// Functions
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomBindingMethod(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomBindingMethodWithArgs(JSC::ExecState*);
+
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (188118 => 188119)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2015-08-07 06:48:27 UTC (rev 188118)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2015-08-07 08:15:13 UTC (rev 188119)
@@ -109,6 +109,10 @@
[Custom] void customMethod();
[Custom] void customMethodWithArgs(long longArg, DOMString strArg, TestObj objArg);
+ // 'CustomBinding' extended attribute
+ [CustomBinding] void customBindingMethod();
+ [CustomBinding] void customBindingMethodWithArgs(long longArg, DOMString strArg, TestObj objArg);
+
void addEventListener(DOMString type, EventListener listener, optional boolean useCapture);
void removeEventListener(DOMString type, EventListener listener, optional boolean useCapture);
attribute EventHandler onfoo;