diff options
Diffstat (limited to 'WebCore/bindings/scripts/CodeGeneratorJS.pm')
-rw-r--r-- | WebCore/bindings/scripts/CodeGeneratorJS.pm | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index c3521bf..4e2e911 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -3,7 +3,7 @@ # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> # Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> -# Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> # Copyright (C) Research In Motion Limited 2010. All rights reserved. # @@ -1170,7 +1170,7 @@ END push(@implContent, " return ${functionName}$overload->{overloadIndex}(exec);\n"); } push(@implContent, <<END); - return JSValue::encode(throwTypeError(exec)); + return throwVMTypeError(exec); } END @@ -1570,20 +1570,9 @@ sub GenerateImplementation push(@implContent, " JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName()", "castedThis") . ";\n"); } } else { + my $getterExpression = "imp->" . $codeGenerator->GetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute) . ")"; + my $jsType = NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, $getterExpression, "castedThis"); push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(castedThis->impl());\n"); - my $value; - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $name : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; - $value = "imp->$getAttributeFunctionName(${namespace}::${contentAttributeName}Attr)" - } else { - $value = "imp->$implGetterFunctionName()"; - } - my $jsType = NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, $value, "castedThis"); if ($codeGenerator->IsSVGAnimatedType($type)) { push(@implContent, " RefPtr<$type> obj = $jsType;\n"); push(@implContent, " JSValue result = toJS(exec, castedThis->globalObject(), obj.get(), imp);\n"); @@ -1734,17 +1723,10 @@ sub GenerateImplementation push(@implContent, " imp->commitChange(podImp, castedThis);\n"); } else { my $nativeValue = JSValueToNative($attribute->signature, "value"); + my $setterExpressionPrefix = $codeGenerator->SetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); + push(@implContent, " ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $name : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - push(@implContent, " imp->setAttribute(${namespace}::${contentAttributeName}Attr, $nativeValue"); - } else { - push(@implContent, " imp->set$implSetterFunctionName($nativeValue"); - } + push(@implContent, " imp->$setterExpressionPrefix$nativeValue"); push(@implContent, ", ec") if @{$attribute->setterExceptions}; push(@implContent, ");\n"); push(@implContent, " setDOMException(exec, ec);\n") if @{$attribute->setterExceptions}; @@ -2330,7 +2312,7 @@ sub JSValueToNative return "static_cast<SVGPaint::SVGPaintType>($value.toInt32(exec))" if $type eq "SVGPaintType"; if ($type eq "DOMString") { - return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"}; + return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"} || $signature->extendedAttributes->{"ReflectURL"}; return "valueToStringWithUndefinedOrNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}; return "ustringToString($value.toString(exec))"; } @@ -2424,13 +2406,6 @@ sub NativeToJSValue } } - if ($codeGenerator->IsSVGAnimatedType($type)) { - # Some SVGFE*Element.idl use 'operator' as attribute name, rewrite as '_operator' to avoid clashes with C/C++ - $value =~ s/operator\(\)/_operator\(\)/ if ($value =~ /operator/); - $value =~ s/\(\)//; - $value .= "Animated()"; - } - if ($type eq "CSSStyleDeclaration") { $implIncludes{"CSSMutableStyleDeclaration.h"} = 1; } @@ -2766,6 +2741,7 @@ sub GenerateConstructorDefinition my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"}; my $customConstructFunction = $dataNode->extendedAttributes->{"CustomConstructFunction"}; my $callWith = $dataNode->extendedAttributes->{"CallWith"}; + my $numberOfconstructParameters = $dataNode->extendedAttributes->{"ConstructorParameters"}; push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", 0, &${constructorClassName}Table, 0 };\n\n"); @@ -2773,6 +2749,7 @@ sub GenerateConstructorDefinition push(@$outputArray, " : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject)\n"); push(@$outputArray, "{\n"); push(@$outputArray, " putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly);\n"); + push(@$outputArray, " putDirect(exec->propertyNames().length, jsNumber(exec, ${numberOfconstructParameters}), ReadOnly | DontDelete | DontEnum);\n") if $numberOfconstructParameters; push(@$outputArray, "}\n\n"); push(@$outputArray, "bool ${constructorClassName}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n"); |