| Index: Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm
|
| diff --git a/Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm b/Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm
|
| index ccf7cef64b2008fcdf7e8ba7c2d9ff141ad47c0a..ef08270220487697f14b6afb00c679dac1bd6a3d 100644
|
| --- a/Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm
|
| +++ b/Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm
|
| @@ -108,6 +108,25 @@ sub GenerateModule
|
| my ($object, $dataNode) = @_;
|
| }
|
|
|
| +my %overrideConstructorParameters = (
|
| + "Float32Array" => 3,
|
| + "Float64Array" => 3,
|
| + "Int8Array" => 3,
|
| + "Int16Array" => 3,
|
| + "Int32Array" => 3,
|
| + "Uint8Array" => 3,
|
| + "Uint16Array" => 3,
|
| + "Uint32Array" => 3,
|
| +);
|
| +
|
| +sub ConstructorParameterCount
|
| +{
|
| + my ($dataNode) = @_;
|
| + return $overrideConstructorParameters{$dataNode->name} if (exists $overrideConstructorParameters{$dataNode->name});
|
| + return $dataNode->extendedAttributes->{ConstructorParameters} if (exists $dataNode->extendedAttributes->{ConstructorParameters});
|
| + return 0;
|
| +}
|
| +
|
| sub GenerateInterface
|
| {
|
| my ($object, $dataNode, $defines) = @_;
|
| @@ -212,17 +231,19 @@ sub HasOptionalParameters
|
| }
|
| }
|
|
|
| -sub HasCustomConstructor
|
| +sub CanBeConstructed
|
| {
|
| my ($dataNode) = @_;
|
|
|
| - # FIXME: switch to using CanBeConstructed attribute.
|
| - return 1 if $dataNode->name eq "FileReader";
|
| - return 1 if $dataNode->name eq "XMLHttpRequest";
|
| - return 1 if $dataNode->name eq "WebKitCSSMatrix";
|
| - return 1 if $dataNode->name eq "WebKitPoint";
|
| + return
|
| + $dataNode->extendedAttributes->{CanBeConstructed} || HasCustomConstructor($dataNode);
|
| +}
|
|
|
| - return 0;
|
| +sub HasCustomConstructor
|
| +{
|
| + my ($dataNode) = @_;
|
| +
|
| + return $dataNode->extendedAttributes->{CustomConstructor} && not ($dataNode->name =~ "Event");
|
| }
|
|
|
| sub IsParameterOptionalInWebKit
|
| @@ -377,6 +398,7 @@ sub IDLTypeToW3C
|
|
|
| my %idlTypeToDart = (
|
| "any" => "Object",
|
| + "any[]" => "List",
|
| "boolean" => "bool",
|
| "custom" => "Object",
|
| "object" => "Object",
|
| @@ -1350,9 +1372,9 @@ my %excludedInterfaces = (
|
| "SVGZoomAndPan" => 1,
|
| );
|
|
|
| -sub ListLike
|
| +sub ListLikeWithBase
|
| {
|
| - my ($elementType, $needsAuxiliaryAccessors) = @_;
|
| + my ($elementType, $baseClass, $needsAuxiliaryAccessors) = @_;
|
|
|
| my @auxiliaryMethods = ();
|
| if ($needsAuxiliaryAccessors) {
|
| @@ -1362,11 +1384,25 @@ sub ListLike
|
|
|
| return IDLTypeInfoStruct->new(
|
| additionalInterfaces => ["List<$elementType>"],
|
| - superClass => "ListBase<$elementType>",
|
| + superClass => "$baseClass",
|
| auxilaryMethods => \@auxiliaryMethods
|
| );
|
| }
|
|
|
| +sub ListLike
|
| +{
|
| + my ($elementType, $needsAuxiliaryAccessors) = @_;
|
| +
|
| + return ListLikeWithBase($elementType, "ListBase<$elementType>", $needsAuxiliaryAccessors);
|
| +}
|
| +
|
| +sub ArrayBufferLike
|
| +{
|
| + my ($elementType, $needsAuxiliaryAccessors) = @_;
|
| +
|
| + return ListLikeWithBase($elementType, "ArrayBufferViewImplementation", $needsAuxiliaryAccessors);
|
| +}
|
| +
|
| sub MapLike
|
| {
|
| # FIXME: most probably we need to deduce more types using hints like
|
| @@ -1395,6 +1431,15 @@ my %idlTypeInfoOverrides = (
|
| "HTMLCollection" => ListLike("Node"),
|
| "NodeList" => ListLike("Node"),
|
| "StyleSheetList" => ListLike("StyleSheet"),
|
| + "ArrayBufferView" => ListLikeWithBase("num", "ListBase<num>"),
|
| + "Float32Array" => ArrayBufferLike("double", 1),
|
| + "Float64Array" => ArrayBufferLike("double", 1),
|
| + "Int8Array" => ArrayBufferLike("int", 1),
|
| + "Int16Array" => ArrayBufferLike("int", 1),
|
| + "Int32Array" => ArrayBufferLike("int", 1),
|
| + "Uint8Array" => ArrayBufferLike("int", 1),
|
| + "Uint16Array" => ArrayBufferLike("int", 1),
|
| + "Uint32Array" => ArrayBufferLike("int", 1),
|
| );
|
|
|
| # FIXME: turn into the single IDL type info registry.
|
| @@ -1436,7 +1481,7 @@ sub GenerateSource
|
|
|
| # Build default clause if any.
|
| my $defaultClause = "";
|
| - if (HasCustomConstructor($dataNode)) {
|
| + if (CanBeConstructed($dataNode)) {
|
| $defaultClause = " default ${w3cInterfaceName}Implementation";
|
| push(@customCallbackDeclarations, GenerateCustomCallbackDeclaration("constructorCallback"));
|
| }
|
| @@ -1487,7 +1532,7 @@ sub GenerateSource
|
| }
|
|
|
| if (HasCustomConstructor($dataNode)) {
|
| - my $parameterCount = $dataNode->extendedAttributes->{"ConstructorParameters"} || 0;
|
| + my $parameterCount = ConstructorParameterCount($dataNode);
|
| my $descriptor = CreateFunctionNativeDescriptor($interfaceName, "constructor", 1 + $parameterCount);
|
| my $nativeId = $descriptor->nativeId;
|
| my $parameters = DartAnonymousNamedOptionalParameters($parameterCount);
|
|
|