Chromium Code Reviews| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 AddToHeaderIncludes("core/svg/properties/SVGPathSegListPropertyTearOff.h "); | 424 AddToHeaderIncludes("core/svg/properties/SVGPathSegListPropertyTearOff.h "); |
| 425 } | 425 } |
| 426 | 426 |
| 427 if ($svgPropertyType) { | 427 if ($svgPropertyType) { |
| 428 $svgPropertyType = "SVGPoint" if $svgPropertyType eq "FloatPoint"; | 428 $svgPropertyType = "SVGPoint" if $svgPropertyType eq "FloatPoint"; |
| 429 } | 429 } |
| 430 | 430 |
| 431 return ($svgPropertyType, $svgListPropertyType, $svgNativeType); | 431 return ($svgPropertyType, $svgListPropertyType, $svgNativeType); |
| 432 } | 432 } |
| 433 | 433 |
| 434 sub MakeDummyFunction | |
| 435 { | |
| 436 my $returnType = shift; | |
| 437 my $methodName = shift; | |
| 438 my $function = domFunction->new(); | |
| 439 $function->signature(domSignature->new()); | |
| 440 $function->signature->type($returnType); | |
| 441 $function->signature->name($methodName); | |
| 442 $function->signature->extendedAttributes({}); | |
| 443 return $function; | |
| 444 } | |
| 445 | |
| 446 sub GetIndexedGetterFunction | |
| 447 { | |
| 448 my $interface = shift; | |
| 449 | |
| 450 # FIXME: Expose indexed getter of WebKitCSSMixFunctionValue by removing this special case | |
| 451 # because CSSValueList(which is parent of WebKitCSSMixFunctionValue) has ind exed property getter. | |
| 452 if ($interface->name eq "WebKitCSSMixFunctionValue") { | |
| 453 return 0; | |
| 454 } | |
| 455 | |
| 456 # FIXME: add getter method to WebKitCSSKeyframesRule.idl or remove special c ase of WebKitCSSKeyframesRule.idl | |
| 457 # Currently return type and method name is hard coded because it can not be obtained from IDL. | |
| 458 if ($interface->name eq "WebKitCSSKeyframesRule") { | |
| 459 return MakeDummyFunction("WebKitCSSKeyframeRule", "item") | |
| 460 } | |
| 461 | |
| 462 return GetSpecialGetterFunctionForType($interface, "unsigned long"); | |
| 463 } | |
| 464 | |
| 434 sub GetNamedGetterFunction | 465 sub GetNamedGetterFunction |
| 435 { | 466 { |
| 436 my $interface = shift; | 467 my $interface = shift; |
| 437 | 468 |
| 438 foreach my $function (@{$interface->functions}) { | 469 return GetSpecialGetterFunctionForType($interface, "DOMString"); |
| 439 my $specials = $function->signature->specials; | 470 } |
| 440 my $getterExists = grep { $_ eq "getter" } @$specials; | 471 |
| 441 my $parameters = $function->parameters; | 472 sub GetSpecialGetterFunctionForType |
| 442 if ($getterExists and scalar(@$parameters) == 1 and $parameters->[0]->ty pe eq "DOMString" ) { | 473 { |
| 443 return $function; | 474 my $interface = shift; |
| 475 my $type = shift; | |
| 476 | |
| 477 my @interfaces = ($interface); | |
| 478 ForAllParents($interface, sub { | |
| 479 my $currentInterface = shift; | |
| 480 push(@interfaces, $currentInterface); | |
| 481 }); | |
| 482 | |
| 483 foreach my $currentInterface (@interfaces) { | |
| 484 foreach my $function (@{$currentInterface->functions}) { | |
| 485 my $specials = $function->signature->specials; | |
| 486 my $getterExists = grep { $_ eq "getter" } @$specials; | |
| 487 my $parameters = $function->parameters; | |
| 488 if ($getterExists and scalar(@$parameters) == 1 and $parameters->[0] ->type eq $type ) { | |
| 489 return $function; | |
| 490 } | |
| 444 } | 491 } |
| 445 } | 492 } |
| 493 | |
| 446 return 0; | 494 return 0; |
| 447 } | 495 } |
| 448 | 496 |
| 449 sub GenerateHeader | 497 sub GenerateHeader |
| 450 { | 498 { |
| 451 my $object = shift; | 499 my $object = shift; |
| 452 my $interface = shift; | 500 my $interface = shift; |
| 453 | 501 |
| 454 my $interfaceName = $interface->name; | 502 my $interfaceName = $interface->name; |
| 455 my $v8InterfaceName = "V8$interfaceName"; | 503 my $v8InterfaceName = "V8$interfaceName"; |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 882 "Storage" => 1, | 930 "Storage" => 1, |
| 883 "HTMLAppletElement" => 1, | 931 "HTMLAppletElement" => 1, |
| 884 "HTMLEmbedElement" => 1, | 932 "HTMLEmbedElement" => 1, |
| 885 "HTMLObjectElement" => 1 | 933 "HTMLObjectElement" => 1 |
| 886 ); | 934 ); |
| 887 | 935 |
| 888 sub GenerateHeaderNamedAndIndexedPropertyAccessors | 936 sub GenerateHeaderNamedAndIndexedPropertyAccessors |
| 889 { | 937 { |
| 890 my $interface = shift; | 938 my $interface = shift; |
| 891 my $interfaceName = $interface->name; | 939 my $interfaceName = $interface->name; |
| 892 my $hasIndexedGetter = $interface->extendedAttributes->{"IndexedGetter"} || $interface->extendedAttributes->{"CustomIndexedGetter"}; | 940 my $hasIndexedGetter = GetIndexedGetterFunction($interface) || $interface->e xtendedAttributes->{"CustomIndexedGetter"}; |
| 893 my $hasCustomIndexedSetter = $interface->extendedAttributes->{"CustomIndexed Setter"}; | 941 my $hasCustomIndexedSetter = $interface->extendedAttributes->{"CustomIndexed Setter"}; |
| 894 my $hasCustomNamedGetter = GetNamedGetterFunction($interface) || $interface- >extendedAttributes->{"CustomNamedGetter"} || $interface->extendedAttributes->{" CustomGetOwnPropertySlot"}; | 942 my $hasCustomNamedGetter = GetNamedGetterFunction($interface) || $interface- >extendedAttributes->{"CustomNamedGetter"} || $interface->extendedAttributes->{" CustomGetOwnPropertySlot"}; |
| 895 my $hasCustomNamedSetter = $interface->extendedAttributes->{"CustomNamedSett er"}; | 943 my $hasCustomNamedSetter = $interface->extendedAttributes->{"CustomNamedSett er"}; |
| 896 my $hasCustomDeleters = $interface->extendedAttributes->{"CustomDeleteProper ty"}; | 944 my $hasCustomDeleters = $interface->extendedAttributes->{"CustomDeleteProper ty"}; |
| 897 my $hasCustomEnumerator = $interface->extendedAttributes->{"CustomEnumerateP roperty"}; | 945 my $hasCustomEnumerator = $interface->extendedAttributes->{"CustomEnumerateP roperty"}; |
| 898 if ($interfaceName eq "HTMLOptionsCollection") { | 946 if ($interfaceName eq "HTMLOptionsCollection") { |
| 899 $interfaceName = "HTMLCollection"; | 947 $interfaceName = "HTMLCollection"; |
| 900 $hasIndexedGetter = 1; | 948 $hasIndexedGetter = 1; |
| 901 $hasCustomNamedGetter = 1; | 949 $hasCustomNamedGetter = 1; |
| 902 } | 950 } |
| (...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2948 } else { | 2996 } else { |
| 2949 $code .= " ${conditional}$template->Set(v8::String::NewSymbol(\"$name \"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback , v8Undefined(), ${signature}, $functionLength)$property_attributes);\n"; | 2997 $code .= " ${conditional}$template->Set(v8::String::NewSymbol(\"$name \"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback , v8Undefined(), ${signature}, $functionLength)$property_attributes);\n"; |
| 2950 } | 2998 } |
| 2951 $code .= "#endif // ${conditionalString}\n" if $conditionalString; | 2999 $code .= "#endif // ${conditionalString}\n" if $conditionalString; |
| 2952 return $code; | 3000 return $code; |
| 2953 } | 3001 } |
| 2954 | 3002 |
| 2955 sub GenerateImplementationIndexedProperty | 3003 sub GenerateImplementationIndexedProperty |
| 2956 { | 3004 { |
| 2957 my $interface = shift; | 3005 my $interface = shift; |
| 2958 my $indexer = shift; | |
| 2959 my $interfaceName = $interface->name; | 3006 my $interfaceName = $interface->name; |
| 2960 my $v8InterfaceName = "V8$interfaceName"; | 3007 my $v8InterfaceName = "V8$interfaceName"; |
| 2961 | 3008 |
| 3009 my $indexedGetterfunction = GetIndexedGetterFunction($interface); | |
| 2962 my $hasCustomIndexedSetter = $interface->extendedAttributes->{"CustomIndexed Setter"}; | 3010 my $hasCustomIndexedSetter = $interface->extendedAttributes->{"CustomIndexed Setter"}; |
| 2963 my $hasIndexedGetter = $interface->extendedAttributes->{"IndexedGetter"} || $interface->extendedAttributes->{"CustomIndexedGetter"}; | 3011 my $hasCustomIndexedGetter = $interface->extendedAttributes->{"CustomIndexed Getter"}; |
| 2964 | 3012 |
| 2965 # FIXME: Investigate and remove this nastinesss. In V8, named property handl ing and indexer handling are apparently decoupled, | 3013 # FIXME: Investigate and remove this nastinesss. In V8, named property handl ing and indexer handling are apparently decoupled, |
| 2966 # which means that object[X] where X is a number doesn't reach named propert y indexer. So we need to provide | 3014 # which means that object[X] where X is a number doesn't reach named propert y indexer. So we need to provide |
| 2967 # simplistic, mirrored indexer handling in addition to named property handli ng. | 3015 # simplistic, mirrored indexer handling in addition to named property handli ng. |
| 2968 my $isSpecialCase = exists $indexerSpecialCases{$interfaceName}; | 3016 my $isSpecialCase = exists $indexerSpecialCases{$interfaceName}; |
| 2969 if ($isSpecialCase) { | 3017 if ($isSpecialCase) { |
| 2970 $hasIndexedGetter = 1; | |
| 2971 if ($interface->extendedAttributes->{"CustomNamedSetter"}) { | 3018 if ($interface->extendedAttributes->{"CustomNamedSetter"}) { |
| 2972 $hasCustomIndexedSetter = 1; | 3019 $hasCustomIndexedSetter = 1; |
| 2973 } | 3020 } |
| 2974 } | 3021 } |
| 2975 | 3022 |
| 2976 # FIXME: Remove the special cases. Interfaces that have indexedPropertyGette r should have indexedPropertyEnumerator. | 3023 # FIXME: Remove the special cases. Interfaces that have indexedPropertyGette r should have indexedPropertyEnumerator. |
| 2977 my $hasEnumerator = !$isSpecialCase && InheritsInterface($interface, "Node") ; | 3024 my $hasEnumerator = !$isSpecialCase && InheritsInterface($interface, "Node") ; |
| 2978 | 3025 |
| 2979 # FIXME: Find a way to not have to special-case HTMLOptionsCollection. | 3026 # FIXME: Find a way to not have to special-case HTMLOptionsCollection. |
| 2980 if ($interfaceName eq "HTMLOptionsCollection") { | 3027 if ($interfaceName eq "HTMLOptionsCollection") { |
| 2981 $hasEnumerator = 1; | 3028 $hasEnumerator = 1; |
| 2982 $hasIndexedGetter = 1; | |
| 2983 } | 3029 } |
| 2984 | 3030 |
| 2985 if (!$hasIndexedGetter) { | 3031 if (!$indexedGetterfunction && !$hasCustomIndexedGetter) { |
| 2986 return ""; | 3032 return ""; |
| 2987 } | 3033 } |
| 2988 | 3034 |
| 2989 AddToImplIncludes("bindings/v8/V8Collection.h"); | 3035 AddToImplIncludes("bindings/v8/V8Collection.h"); |
| 2990 | 3036 |
| 2991 if (!$indexer) { | 3037 if ($indexedGetterfunction && !$hasCustomIndexedSetter) { |
| 2992 $indexer = FindSuperMethod($interface, "item"); | 3038 $hasEnumerator = 1; |
| 2993 } | 3039 } |
| 2994 | 3040 if ($interfaceName eq "WebKitCSSKeyframesRule") { |
| 2995 my $indexerType = $indexer ? $indexer->type : 0; | 3041 $hasEnumerator = 0; |
| 2996 | |
| 2997 if ($indexerType && !$hasCustomIndexedSetter) { | |
| 2998 $hasEnumerator = 1; | |
| 2999 } | 3042 } |
|
kojih
2013/05/01 08:50:22
Although I think every object that have IndexedPro
| |
| 3000 | 3043 |
| 3001 my $hasDeleter = $interface->extendedAttributes->{"CustomDeleteProperty"}; | 3044 my $hasDeleter = $interface->extendedAttributes->{"CustomDeleteProperty"}; |
| 3002 my $setOn = "Instance"; | 3045 my $setOn = "Instance"; |
| 3003 | 3046 |
| 3004 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallba cks) and it's used on DOMWindow | 3047 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallba cks) and it's used on DOMWindow |
| 3005 # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to | 3048 # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to |
| 3006 # get implementation straight out of the DOMWindow prototype regardless of w hat prototype is actually set | 3049 # get implementation straight out of the DOMWindow prototype regardless of w hat prototype is actually set |
| 3007 # on the object. | 3050 # on the object. |
| 3008 if ($interfaceName eq "DOMWindow") { | 3051 if ($interfaceName eq "DOMWindow") { |
| 3009 $setOn = "Prototype"; | 3052 $setOn = "Prototype"; |
| 3010 } | 3053 } |
| 3011 # FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter | 3054 # FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter |
| 3012 if ($interfaceName eq "DataTransferItemList") { | 3055 if ($interfaceName eq "DataTransferItemList") { |
| 3013 $hasDeleter = 0; | 3056 $hasDeleter = 0; |
| 3014 } | 3057 } |
| 3015 | 3058 |
| 3016 my $code = ""; | 3059 my $code = ""; |
| 3017 $code .= " desc->${setOn}Template()->SetIndexedPropertyHandler(${v8Interf aceName}::indexedPropertyGetter"; | 3060 $code .= " desc->${setOn}Template()->SetIndexedPropertyHandler(${v8Interf aceName}::indexedPropertyGetter"; |
| 3018 $code .= $hasCustomIndexedSetter ? ", ${v8InterfaceName}::indexedPropertySet ter" : ", 0"; | 3061 $code .= $hasCustomIndexedSetter ? ", ${v8InterfaceName}::indexedPropertySet ter" : ", 0"; |
| 3019 $code .= ", 0"; # IndexedPropertyQuery -- not being used at the moment. | 3062 $code .= ", 0"; # IndexedPropertyQuery -- not being used at the moment. |
| 3020 $code .= $hasDeleter ? ", ${v8InterfaceName}::indexedPropertyDeleter" : ", 0 "; | 3063 $code .= $hasDeleter ? ", ${v8InterfaceName}::indexedPropertyDeleter" : ", 0 "; |
| 3021 $code .= ", nodeCollectionIndexedPropertyEnumerator<${interfaceName}>" if $h asEnumerator; | 3064 $code .= ", nodeCollectionIndexedPropertyEnumerator<${interfaceName}>" if $h asEnumerator; |
| 3022 $code .= ");\n"; | 3065 $code .= ");\n"; |
| 3023 | 3066 |
| 3024 if($interface->extendedAttributes->{"IndexedGetter"}) { | 3067 if ($indexedGetterfunction && !$hasCustomIndexedGetter) { |
| 3025 # FIXME: add item() method to WebKitCSSKeyframesRule.idl or remove [Inde xedGetter] from WebKitCSSKeyframesRule.idl | 3068 my $returnType = $indexedGetterfunction->signature->type; |
| 3026 # Currently indexer type is hard coded because it can not be obtained fr om IDL. | 3069 my $methodName = $indexedGetterfunction->signature->name; |
| 3027 if ($interfaceName eq "WebKitCSSKeyframesRule") { | 3070 AddToImplIncludes("bindings/v8/V8Collection.h"); |
| 3028 $indexerType = "WebKitCSSKeyframeRule"; | |
| 3029 } | |
| 3030 my $jsValue = ""; | 3071 my $jsValue = ""; |
| 3031 my $nativeType = GetNativeType($indexerType); | 3072 my $nativeType = GetNativeType($returnType); |
| 3032 my $isNull = ""; | 3073 my $isNull = ""; |
| 3033 | 3074 |
| 3034 if (IsRefPtrType($indexerType)) { | 3075 if (IsRefPtrType($returnType)) { |
| 3076 AddToImplIncludes("V8$returnType.h"); | |
| 3035 $isNull = "!element"; | 3077 $isNull = "!element"; |
| 3036 if ($interfaceName eq "WebKitCSSKeyframesRule") { | 3078 $jsValue = NativeToJSValue($indexedGetterfunction->signature, "eleme nt.release()", "info.Holder()", "info.GetIsolate()", "info", "collection", "", " "); |
| 3037 $jsValue = "toV8(element.release(), info.Holder(), info.GetIsola te())"; | |
| 3038 } else { | |
| 3039 $jsValue = NativeToJSValue($indexer, "element.release()", "info. Holder()", "info.GetIsolate()"); | |
| 3040 } | |
| 3041 } else { | 3079 } else { |
| 3042 $isNull = "element.isNull()"; | 3080 $isNull = "element.isNull()"; |
| 3043 $jsValue = NativeToJSValue($indexer, "element", "info.Holder()", "in fo.GetIsolate()"); | 3081 $jsValue = NativeToJSValue($indexedGetterfunction->signature, "eleme nt", "info.Holder()", "info.GetIsolate()"); |
| 3044 } | 3082 } |
| 3045 | 3083 |
| 3046 AddToImplContent(<<END); | 3084 AddToImplContent(<<END); |
| 3047 v8::Handle<v8::Value> ${v8InterfaceName}::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) | 3085 v8::Handle<v8::Value> ${v8InterfaceName}::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) |
| 3048 { | 3086 { |
| 3049 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); | 3087 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); |
| 3050 ${interfaceName}* collection = toNative(info.Holder()); | 3088 ${interfaceName}* collection = toNative(info.Holder()); |
| 3051 $nativeType element = collection->item(index); | 3089 $nativeType element = collection->$methodName(index); |
| 3052 if ($isNull) | 3090 if ($isNull) |
| 3053 return v8Undefined(); | 3091 return v8Undefined(); |
| 3054 return $jsValue; | 3092 return $jsValue; |
| 3055 } | 3093 } |
| 3056 END | 3094 END |
| 3057 } | 3095 } |
| 3058 return $code; | 3096 return $code; |
| 3059 } | 3097 } |
| 3060 | 3098 |
| 3061 sub GenerateImplementationNamedPropertyGetter | 3099 sub GenerateImplementationNamedPropertyGetter |
| 3062 { | 3100 { |
| 3063 my $interface = shift; | 3101 my $interface = shift; |
| 3064 | 3102 |
| 3065 my $subCode = ""; | 3103 my $subCode = ""; |
| 3066 my $interfaceName = $interface->name; | 3104 my $interfaceName = $interface->name; |
| 3067 my $v8InterfaceName = "V8$interfaceName"; | 3105 my $v8InterfaceName = "V8$interfaceName"; |
| 3068 | 3106 |
| 3069 my $function = GetNamedGetterFunction($interface); | 3107 my $namedGetterFunction = GetNamedGetterFunction($interface); |
| 3070 if ($function) { | 3108 my $hasCustomNamedGetter = $interface->extendedAttributes->{"CustomNamedGett er"}; |
| 3071 my $returnType = $function->signature->type; | 3109 # FIXME: make consistent between IDL and implementation. Then remove these s pecial cases. |
| 3072 my $methodName = $function->signature->name; | 3110 $hasCustomNamedGetter = 1 if $interfaceName eq "HTMLAppletElement"; |
| 3111 $hasCustomNamedGetter = 1 if $interfaceName eq "HTMLEmbedElement"; | |
| 3112 $hasCustomNamedGetter = 1 if $interfaceName eq "HTMLObjectElement"; | |
| 3113 $hasCustomNamedGetter = 1 if $interfaceName eq "DOMWindow"; | |
| 3114 $hasCustomNamedGetter = 0 if $interfaceName eq "HTMLDocument"; | |
| 3115 | |
| 3116 if ($namedGetterFunction && !$hasCustomNamedGetter) { | |
| 3117 my $returnType = $namedGetterFunction->signature->type; | |
| 3118 my $methodName = $namedGetterFunction->signature->name; | |
| 3073 AddToImplIncludes("bindings/v8/V8Collection.h"); | 3119 AddToImplIncludes("bindings/v8/V8Collection.h"); |
| 3074 AddToImplIncludes("V8$returnType.h"); | 3120 AddToImplIncludes("V8$returnType.h"); |
| 3075 $subCode .= <<END; | 3121 $subCode .= <<END; |
| 3076 desc->InstanceTemplate()->SetNamedPropertyHandler(${v8InterfaceName}::namedP ropertyGetter, 0, 0, 0, 0); | 3122 desc->InstanceTemplate()->SetNamedPropertyHandler(${v8InterfaceName}::namedP ropertyGetter, 0, 0, 0, 0); |
| 3077 END | 3123 END |
| 3078 | 3124 |
| 3079 my $code .= <<END; | 3125 my $code .= <<END; |
| 3080 v8::Handle<v8::Value> ${v8InterfaceName}::namedPropertyGetter(v8::Local<v8::Stri ng> name, const v8::AccessorInfo& info) | 3126 v8::Handle<v8::Value> ${v8InterfaceName}::namedPropertyGetter(v8::Local<v8::Stri ng> name, const v8::AccessorInfo& info) |
| 3081 { | 3127 { |
| 3082 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 3128 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 3095 if (!element) | 3141 if (!element) |
| 3096 return v8Undefined(); | 3142 return v8Undefined(); |
| 3097 | 3143 |
| 3098 return toV8Fast(element.release(), info, collection); | 3144 return toV8Fast(element.release(), info, collection); |
| 3099 } | 3145 } |
| 3100 | 3146 |
| 3101 END | 3147 END |
| 3102 AddToImplContent($code); | 3148 AddToImplContent($code); |
| 3103 } | 3149 } |
| 3104 | 3150 |
| 3105 my $hasCustomNamedGetter = $interface->extendedAttributes->{"CustomNamedGett er"}; | |
| 3106 # FIXME: make consistent between IDL and implementation. Then remove these s pecial cases. | |
| 3107 $hasCustomNamedGetter = 1 if $interfaceName eq "HTMLAppletElement"; | |
| 3108 $hasCustomNamedGetter = 1 if $interfaceName eq "HTMLEmbedElement"; | |
| 3109 $hasCustomNamedGetter = 1 if $interfaceName eq "HTMLObjectElement"; | |
| 3110 $hasCustomNamedGetter = 1 if $interfaceName eq "DOMWindow"; | |
| 3111 $hasCustomNamedGetter = 0 if $interfaceName eq "HTMLDocument"; | |
| 3112 | |
| 3113 if ($hasCustomNamedGetter) { | 3151 if ($hasCustomNamedGetter) { |
| 3114 my $hasCustomNamedSetter = $interface->extendedAttributes->{"CustomNamed Setter"}; | 3152 my $hasCustomNamedSetter = $interface->extendedAttributes->{"CustomNamed Setter"}; |
| 3115 my $hasDeleter = $interface->extendedAttributes->{"CustomDeleteProperty" }; | 3153 my $hasDeleter = $interface->extendedAttributes->{"CustomDeleteProperty" }; |
| 3116 my $hasEnumerator = $interface->extendedAttributes->{"CustomEnumeratePro perty"}; | 3154 my $hasEnumerator = $interface->extendedAttributes->{"CustomEnumeratePro perty"}; |
| 3117 my $setOn = "Instance"; | 3155 my $setOn = "Instance"; |
| 3118 | 3156 |
| 3119 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCa llbacks) and it's used on DOMWindow | 3157 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCa llbacks) and it's used on DOMWindow |
| 3120 # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to | 3158 # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to |
| 3121 # get implementation straight out of the DOMWindow prototype regardless of what prototype is actually set | 3159 # get implementation straight out of the DOMWindow prototype regardless of what prototype is actually set |
| 3122 # on the object. | 3160 # on the object. |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3643 $code .= "\n#if ${conditionalString}\n" if $conditionalString; | 3681 $code .= "\n#if ${conditionalString}\n" if $conditionalString; |
| 3644 $code .= " if (${enable_function}()) {\n"; | 3682 $code .= " if (${enable_function}()) {\n"; |
| 3645 $code .= <<END; | 3683 $code .= <<END; |
| 3646 static const V8DOMConfiguration::BatchedConstant constData = {"${name}", static_cast<signed int>(${value})}; | 3684 static const V8DOMConfiguration::BatchedConstant constData = {"${name}", static_cast<signed int>(${value})}; |
| 3647 V8DOMConfiguration::batchConfigureConstants(desc, proto, &constData, 1, isolate); | 3685 V8DOMConfiguration::batchConfigureConstants(desc, proto, &constData, 1, isolate); |
| 3648 END | 3686 END |
| 3649 $code .= " }\n"; | 3687 $code .= " }\n"; |
| 3650 $code .= "\n#endif // ${conditionalString}\n" if $conditionalString; | 3688 $code .= "\n#endif // ${conditionalString}\n" if $conditionalString; |
| 3651 } | 3689 } |
| 3652 | 3690 |
| 3653 $code .= GenerateImplementationIndexedProperty($interface, $indexer); | 3691 $code .= GenerateImplementationIndexedProperty($interface); |
| 3654 $code .= GenerateImplementationNamedPropertyGetter($interface); | 3692 $code .= GenerateImplementationNamedPropertyGetter($interface); |
| 3655 $code .= GenerateImplementationCustomCall($interface); | 3693 $code .= GenerateImplementationCustomCall($interface); |
| 3656 $code .= GenerateImplementationMasqueradesAsUndefined($interface); | 3694 $code .= GenerateImplementationMasqueradesAsUndefined($interface); |
| 3657 | 3695 |
| 3658 # Define our functions with Set() or SetAccessor() | 3696 # Define our functions with Set() or SetAccessor() |
| 3659 my $total_functions = 0; | 3697 my $total_functions = 0; |
| 3660 foreach my $function (@normalFunctions) { | 3698 foreach my $function (@normalFunctions) { |
| 3661 # Only one accessor is needed for overloaded methods: | 3699 # Only one accessor is needed for overloaded methods: |
| 3662 next if $function->{overloadIndex} > 1; | 3700 next if $function->{overloadIndex} > 1; |
| 3663 | 3701 |
| (...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5557 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 5595 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
| 5558 $found = 1; | 5596 $found = 1; |
| 5559 } | 5597 } |
| 5560 return 1 if $found; | 5598 return 1 if $found; |
| 5561 }, 0); | 5599 }, 0); |
| 5562 | 5600 |
| 5563 return $found; | 5601 return $found; |
| 5564 } | 5602 } |
| 5565 | 5603 |
| 5566 1; | 5604 1; |
| OLD | NEW |