Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (94004 => 94005)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-08-29 19:35:08 UTC (rev 94004)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-08-29 20:03:33 UTC (rev 94005)
@@ -312,6 +312,28 @@
}
}
+sub AddToImplIncludes
+{
+ my $header = shift;
+ my $conditional = shift;
+
+ if (not $conditional) {
+ $implIncludes{$header} = 1;
+ } elsif (not exists($implIncludes{$header})) {
+ $implIncludes{$header} = $conditional;
+ } else {
+ my $oldValue = $implIncludes{$header};
+ if ($oldValue ne 1) {
+ my %newValue = ();
+ $newValue{$conditional} = 1;
+ foreach my $condition (split(/\|/, $oldValue)) {
+ $newValue{$condition} = 1;
+ }
+ $implIncludes{$header} = join("|", sort keys %newValue);
+ }
+ }
+}
+
sub IsScriptProfileType
{
my $type = shift;
@@ -1785,23 +1807,7 @@
my $constructorType = $attribute->signature->type;
$constructorType =~ s/Constructor$//;
if ($constructorType ne "DOMObject") {
- my $header = "JS" . $constructorType . ".h";
- my $conditional = $attribute->signature->extendedAttributes->{"Conditional"};
- if (not $conditional) {
- $implIncludes{$header} = 1;
- } elsif (not exists($implIncludes{$header})) {
- $implIncludes{$header} = $conditional;
- } else {
- my $oldValue = $implIncludes{$header};
- if ($oldValue ne 1) {
- my %newValue = ();
- $newValue{$conditional} = 1;
- foreach my $condition (split(/\|/, $oldValue)) {
- $newValue{$condition} = 1;
- }
- $implIncludes{$header} = join("|", sort keys %newValue);
- }
- }
+ AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{"Conditional"});
}
push(@implContent, " // Shadowing a built-in constructor\n");
if ($interfaceName eq "DOMWindow" && $className eq "JSblah") {
@@ -2630,6 +2636,7 @@
my $signature = shift;
my $value = shift;
+ my $conditional = $signature->extendedAttributes->{"Conditional"};
my $type = $codeGenerator->StripModule($signature->type);
return "$value.toBoolean(exec)" if $type eq "boolean";
@@ -2653,32 +2660,32 @@
}
if ($type eq "NodeFilter") {
- $implIncludes{"JS$type.h"} = 1;
+ AddToImplIncludes("JS$type.h", $conditional);
return "to$type(exec->globalData(), $value)";
}
if ($type eq "MediaQueryListListener") {
- $implIncludes{"MediaQueryListListener.h"} = 1;
+ AddToImplIncludes("MediaQueryListListener.h", $conditional);
return "MediaQueryListListener::create(ScriptValue(exec->globalData(), " . $value ."))";
}
if ($type eq "SerializedScriptValue" or $type eq "any") {
- $implIncludes{"SerializedScriptValue.h"} = 1;
+ AddToImplIncludes("SerializedScriptValue.h", $conditional);
return "SerializedScriptValue::create(exec, $value)";
}
if ($type eq "IDBKey") {
- $implIncludes{"IDBBindingUtilities.h"} = 1;
- $implIncludes{"IDBKey.h"} = 1;
+ AddToImplIncludes("IDBBindingUtilities.h", $conditional);
+ AddToImplIncludes("IDBKey.h", $conditional);
return "createIDBKeyFromValue(exec, $value)";
}
- $implIncludes{"HTMLOptionElement.h"} = 1 if $type eq "HTMLOptionElement";
- $implIncludes{"JSCustomVoidCallback.h"} = 1 if $type eq "VoidCallback";
- $implIncludes{"Event.h"} = 1 if $type eq "Event";
+ AddToImplIncludes("HTMLOptionElement.h", $conditional) if $type eq "HTMLOptionElement";
+ AddToImplIncludes("JSCustomVoidCallback.h", $conditional) if $type eq "VoidCallback";
+ AddToImplIncludes("Event.h", $conditional) if $type eq "Event";
# Default, assume autogenerated type conversion routines
- $implIncludes{"JS$type.h"} = 1;
+ AddToImplIncludes("JS$type.h", $conditional);
return "to$type($value)";
}
@@ -2690,6 +2697,7 @@
my $value = shift;
my $thisValue = shift;
+ my $conditional = $signature->extendedAttributes->{"Conditional"};
my $type = $codeGenerator->StripModule($signature->type);
return "jsBoolean($value)" if $type eq "boolean";
@@ -2709,7 +2717,7 @@
}
if ($codeGenerator->IsStringType($type)) {
- $implIncludes{"KURL.h"} = 1;
+ AddToImplIncludes("KURL.h", $conditional);
my $conv = $signature->extendedAttributes->{"ConvertNullStringTo"};
if (defined $conv) {
return "jsStringOrNull(exec, $value)" if $conv eq "Null";
@@ -2720,38 +2728,38 @@
}
$conv = $signature->extendedAttributes->{"ConvertScriptString"};
return "jsOwnedStringOrNull(exec, $value)" if $conv;
- $implIncludes{"<runtime/JSString.h>"} = 1;
+ AddToImplIncludes("<runtime/JSString.h>", $conditional);
return "jsString(exec, $value)";
}
my $globalObject = "$thisValue->globalObject()";
if ($type eq "CSSStyleDeclaration") {
- $implIncludes{"CSSMutableStyleDeclaration.h"} = 1;
+ AddToImplIncludes("CSSMutableStyleDeclaration.h", $conditional);
}
if ($type eq "NodeList") {
- $implIncludes{"NameNodeList.h"} = 1;
+ AddToImplIncludes("NameNodeList.h", $conditional);
}
if ($type eq "DOMObject") {
if ($implClassName eq "Document") {
- $implIncludes{"JSCanvasRenderingContext2D.h"} = 1;
+ AddToImplIncludes("JSCanvasRenderingContext2D.h", $conditional);
} else {
return "($value.hasNoValue() ? jsNull() : $value.jsValue())";
}
} elsif ($type =~ /SVGPathSeg/) {
- $implIncludes{"JS$type.h"} = 1;
+ AddToImplIncludes("JS$type.h", $conditional);
my $joinedName = $type;
$joinedName =~ s/Abs|Rel//;
- $implIncludes{"$joinedName.h"} = 1;
+ AddToImplIncludes("$joinedName.h", $conditional);
} elsif ($type eq "SerializedScriptValue" or $type eq "any") {
- $implIncludes{"SerializedScriptValue.h"} = 1;
+ AddToImplIncludes("SerializedScriptValue.h", $conditional);
return "$value ? $value->deserialize(exec, castedThis->globalObject()) : jsNull()";
} else {
# Default, include header with same name.
- $implIncludes{"JS$type.h"} = 1;
- $implIncludes{"$type.h"} = 1 if not $codeGenerator->AvoidInclusionOfType($type);
+ AddToImplIncludes("JS$type.h", $conditional);
+ AddToImplIncludes("$type.h", $conditional) if not $codeGenerator->AvoidInclusionOfType($type);
}
return $value if $codeGenerator->IsSVGAnimatedType($type);
@@ -2774,7 +2782,7 @@
my $selfIsTearOffType = $codeGenerator->IsSVGTypeNeedingTearOff($implClassName);
if ($selfIsTearOffType) {
- $implIncludes{"SVGStaticPropertyWithParentTearOff.h"} = 1;
+ AddToImplIncludes("SVGStaticPropertyWithParentTearOff.h", $conditional);
$tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyWithParentTearOff<$implClassName, /;
if ($value =~ /matrix/ and $implClassName eq "SVGTransform") {
@@ -2785,7 +2793,7 @@
$value = "${tearOffType}::create(castedThis->impl(), $value, $updateMethod)";
} else {
- $implIncludes{"SVGStaticPropertyTearOff.h"} = 1;
+ AddToImplIncludes("SVGStaticPropertyTearOff.h", $conditional);
$tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$implClassName, /;
$value = "${tearOffType}::create(imp, $value, $updateMethod)";
}