| OLD | NEW |
| 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> | 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |
| 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
| 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
| 5 # Copyright (C) 2006 Apple Computer, Inc. | 5 # Copyright (C) 2006 Apple Computer, Inc. |
| 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. | 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. |
| 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. | 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 # Copyright (C) 2012 Ericsson AB. All rights reserved. | 10 # Copyright (C) 2012 Ericsson AB. All rights reserved. |
| (...skipping 3193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3204 if ($interfaceName eq "Window") { | 3204 if ($interfaceName eq "Window") { |
| 3205 $setOn = "Prototype"; | 3205 $setOn = "Prototype"; |
| 3206 } | 3206 } |
| 3207 | 3207 |
| 3208 my $code = ""; | 3208 my $code = ""; |
| 3209 if ($indexedGetterFunction || $indexedSetterFunction || $indexedDeleterFunct
ion || $indexedEnumeratorFunction || $hasQuery) { | 3209 if ($indexedGetterFunction || $indexedSetterFunction || $indexedDeleterFunct
ion || $indexedEnumeratorFunction || $hasQuery) { |
| 3210 $code .= " desc->${setOn}Template()->SetIndexedPropertyHandler(${impl
ClassName}V8Internal::indexedPropertyGetterCallback"; | 3210 $code .= " desc->${setOn}Template()->SetIndexedPropertyHandler(${impl
ClassName}V8Internal::indexedPropertyGetterCallback"; |
| 3211 $code .= $indexedSetterFunction ? ", ${implClassName}V8Internal::indexed
PropertySetterCallback" : ", 0"; | 3211 $code .= $indexedSetterFunction ? ", ${implClassName}V8Internal::indexed
PropertySetterCallback" : ", 0"; |
| 3212 $code .= ", 0"; # IndexedPropertyQuery -- not being used at the moment. | 3212 $code .= ", 0"; # IndexedPropertyQuery -- not being used at the moment. |
| 3213 $code .= $indexedDeleterFunction ? ", ${implClassName}V8Internal::indexe
dPropertyDeleterCallback" : ", 0"; | 3213 $code .= $indexedDeleterFunction ? ", ${implClassName}V8Internal::indexe
dPropertyDeleterCallback" : ", 0"; |
| 3214 $code .= ", nodeCollectionIndexedPropertyEnumerator<${implClassName}>" i
f $indexedEnumeratorFunction; | 3214 $code .= ", indexedPropertyEnumerator<${implClassName}>" if $indexedEnum
eratorFunction; |
| 3215 $code .= ");\n"; | 3215 $code .= ");\n"; |
| 3216 } | 3216 } |
| 3217 | 3217 |
| 3218 return $code; | 3218 return $code; |
| 3219 } | 3219 } |
| 3220 | 3220 |
| 3221 sub GenerateImplementationIndexedPropertyGetter | 3221 sub GenerateImplementationIndexedPropertyGetter |
| 3222 { | 3222 { |
| 3223 my $interface = shift; | 3223 my $interface = shift; |
| 3224 my $indexedGetterFunction = shift; | 3224 my $indexedGetterFunction = shift; |
| 3225 my $implClassName = GetImplName($interface); | 3225 my $implClassName = GetImplName($interface); |
| 3226 my $v8ClassName = GetV8ClassName($interface); | 3226 my $v8ClassName = GetV8ClassName($interface); |
| 3227 my $methodName = GetImplName($indexedGetterFunction); | 3227 my $methodName = GetImplName($indexedGetterFunction); |
| 3228 | 3228 |
| 3229 AddToImplIncludes("bindings/v8/V8Collection.h"); | |
| 3230 my $returnType = $indexedGetterFunction->type; | 3229 my $returnType = $indexedGetterFunction->type; |
| 3231 my $nativeType = GetNativeType($returnType); | 3230 my $nativeType = GetNativeType($returnType); |
| 3232 my $nativeValue = "element"; | 3231 my $nativeValue = "element"; |
| 3233 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 3232 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
| 3234 my $isNull = GenerateIsNullExpression($returnType, "element"); | 3233 my $isNull = GenerateIsNullExpression($returnType, "element"); |
| 3235 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()",
"info.GetIsolate()", "info", "collection", "", "", "return"); | 3234 my $returnJSValueCode = NativeToJSValue($indexedGetterFunction->type, $index
edGetterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()",
"info.GetIsolate()", "info", "collection", "", "", "return"); |
| 3236 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; | 3235 my $raisesExceptions = $indexedGetterFunction->extendedAttributes->{"RaisesE
xception"}; |
| 3237 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "index", $raisesExceptions); | 3236 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "index", $raisesExceptions); |
| 3238 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; | 3237 my $getterCode = "static void indexedPropertyGetter(uint32_t index, const v8
::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3239 $getterCode .= "{\n"; | 3238 $getterCode .= "{\n"; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3316 } | 3315 } |
| 3317 | 3316 |
| 3318 sub GenerateImplementationIndexedPropertySetter | 3317 sub GenerateImplementationIndexedPropertySetter |
| 3319 { | 3318 { |
| 3320 my $interface = shift; | 3319 my $interface = shift; |
| 3321 my $indexedSetterFunction = shift; | 3320 my $indexedSetterFunction = shift; |
| 3322 my $implClassName = GetImplName($interface); | 3321 my $implClassName = GetImplName($interface); |
| 3323 my $v8ClassName = GetV8ClassName($interface); | 3322 my $v8ClassName = GetV8ClassName($interface); |
| 3324 my $methodName = GetImplName($indexedSetterFunction); | 3323 my $methodName = GetImplName($indexedSetterFunction); |
| 3325 | 3324 |
| 3326 AddToImplIncludes("bindings/v8/V8Collection.h"); | |
| 3327 my $type = $indexedSetterFunction->parameters->[1]->type; | 3325 my $type = $indexedSetterFunction->parameters->[1]->type; |
| 3328 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE
xception"}; | 3326 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE
xception"}; |
| 3329 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute
s->{"TreatNullAs"}; | 3327 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute
s->{"TreatNullAs"}; |
| 3330 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr
ibutes->{"TreatUndefinedAs"}; | 3328 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr
ibutes->{"TreatUndefinedAs"}; |
| 3331 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 3329 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8::
Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3332 $code .= "{\n"; | 3330 $code .= "{\n"; |
| 3333 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3331 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
| 3334 $code .= GenerateNativeValueDefinition($indexedSetterFunction, $indexedSette
rFunction->parameters->[1], "value", "propertyValue", "info.GetIsolate()"); | 3332 $code .= GenerateNativeValueDefinition($indexedSetterFunction, $indexedSette
rFunction->parameters->[1], "value", "propertyValue", "info.GetIsolate()"); |
| 3335 | 3333 |
| 3336 my $extraArguments = ""; | 3334 my $extraArguments = ""; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3565 } | 3563 } |
| 3566 | 3564 |
| 3567 sub GenerateImplementationNamedPropertyGetter | 3565 sub GenerateImplementationNamedPropertyGetter |
| 3568 { | 3566 { |
| 3569 my $interface = shift; | 3567 my $interface = shift; |
| 3570 my $namedGetterFunction = shift; | 3568 my $namedGetterFunction = shift; |
| 3571 my $implClassName = GetImplName($interface); | 3569 my $implClassName = GetImplName($interface); |
| 3572 my $v8ClassName = GetV8ClassName($interface); | 3570 my $v8ClassName = GetV8ClassName($interface); |
| 3573 my $methodName = GetImplName($namedGetterFunction); | 3571 my $methodName = GetImplName($namedGetterFunction); |
| 3574 | 3572 |
| 3575 AddToImplIncludes("bindings/v8/V8Collection.h"); | |
| 3576 my $returnType = $namedGetterFunction->type; | 3573 my $returnType = $namedGetterFunction->type; |
| 3577 my $isNull = GenerateIsNullExpression($returnType, "element"); | 3574 my $isNull = GenerateIsNullExpression($returnType, "element"); |
| 3578 my $nativeValue = "element"; | 3575 my $nativeValue = "element"; |
| 3579 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); | 3576 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); |
| 3580 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()", "in
fo.GetIsolate()", "info", "collection", "", "", "return"); | 3577 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->type, $namedGe
tterFunction->extendedAttributes, $nativeValue, " ", "", "info.Holder()", "in
fo.GetIsolate()", "info", "collection", "", "", "return"); |
| 3581 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; | 3578 my $raisesExceptions = $namedGetterFunction->extendedAttributes->{"RaisesExc
eption"}; |
| 3582 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "propertyName", $raisesExceptions); | 3579 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection-
>${methodName}", "propertyName", $raisesExceptions); |
| 3583 | 3580 |
| 3584 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 3581 my $code = "static void namedPropertyGetter(v8::Local<v8::String> name, cons
t v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3585 $code .= "{\n"; | 3582 $code .= "{\n"; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3646 } | 3643 } |
| 3647 | 3644 |
| 3648 sub GenerateImplementationNamedPropertySetter | 3645 sub GenerateImplementationNamedPropertySetter |
| 3649 { | 3646 { |
| 3650 my $interface = shift; | 3647 my $interface = shift; |
| 3651 my $namedSetterFunction = shift; | 3648 my $namedSetterFunction = shift; |
| 3652 my $implClassName = GetImplName($interface); | 3649 my $implClassName = GetImplName($interface); |
| 3653 my $v8ClassName = GetV8ClassName($interface); | 3650 my $v8ClassName = GetV8ClassName($interface); |
| 3654 my $methodName = GetImplName($namedSetterFunction); | 3651 my $methodName = GetImplName($namedSetterFunction); |
| 3655 | 3652 |
| 3656 AddToImplIncludes("bindings/v8/V8Collection.h"); | |
| 3657 my $raisesExceptions = $namedSetterFunction->extendedAttributes->{"RaisesExc
eption"}; | 3653 my $raisesExceptions = $namedSetterFunction->extendedAttributes->{"RaisesExc
eption"}; |
| 3658 my $treatNullAs = $namedSetterFunction->parameters->[1]->extendedAttributes-
>{"TreatNullAs"}; | 3654 my $treatNullAs = $namedSetterFunction->parameters->[1]->extendedAttributes-
>{"TreatNullAs"}; |
| 3659 my $treatUndefinedAs = $namedSetterFunction->parameters->[1]->extendedAttrib
utes->{"TreatUndefinedAs"}; | 3655 my $treatUndefinedAs = $namedSetterFunction->parameters->[1]->extendedAttrib
utes->{"TreatUndefinedAs"}; |
| 3660 | 3656 |
| 3661 my $code = "static void namedPropertySetter(v8::Local<v8::String> name, v8::
Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; | 3657 my $code = "static void namedPropertySetter(v8::Local<v8::String> name, v8::
Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; |
| 3662 $code .= "{\n"; | 3658 $code .= "{\n"; |
| 3663 if (!$namedSetterFunction->extendedAttributes->{"OverrideBuiltins"}) { | 3659 if (!$namedSetterFunction->extendedAttributes->{"OverrideBuiltins"}) { |
| 3664 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; | 3660 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n
ame).IsEmpty())\n"; |
| 3665 $code .= " return;\n"; | 3661 $code .= " return;\n"; |
| 3666 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; | 3662 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; |
| (...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6040 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 6036 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
| 6041 $found = 1; | 6037 $found = 1; |
| 6042 } | 6038 } |
| 6043 return 1 if $found; | 6039 return 1 if $found; |
| 6044 }, 0); | 6040 }, 0); |
| 6045 | 6041 |
| 6046 return $found; | 6042 return $found; |
| 6047 } | 6043 } |
| 6048 | 6044 |
| 6049 1; | 6045 1; |
| OLD | NEW |