| OLD | NEW |
| 1 | 1 |
| 2 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> | 3 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |
| 4 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 4 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
| 5 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 5 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
| 6 # Copyright (C) 2006 Apple Computer, Inc. | 6 # Copyright (C) 2006 Apple Computer, Inc. |
| 7 # Copyright (C) 2007, 2008, 2009 Google Inc. | 7 # Copyright (C) 2007, 2008, 2009 Google Inc. |
| 8 # | 8 # |
| 9 # This file is part of the KDE project | 9 # This file is part of the KDE project |
| 10 # | 10 # |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 my $result = ""; | 327 my $result = ""; |
| 328 | 328 |
| 329 $result .= $indent . "if (ec) {\n"; | 329 $result .= $indent . "if (ec) {\n"; |
| 330 $result .= $indent . " V8Proxy::setDOMException(ec);\n"; | 330 $result .= $indent . " V8Proxy::setDOMException(ec);\n"; |
| 331 $result .= $indent . " return v8::Handle<v8::Value>();\n"; | 331 $result .= $indent . " return v8::Handle<v8::Value>();\n"; |
| 332 $result .= $indent . "}\n"; | 332 $result .= $indent . "}\n"; |
| 333 | 333 |
| 334 return $result; | 334 return $result; |
| 335 } | 335 } |
| 336 | 336 |
| 337 sub IsNodeSubType | 337 sub IsSubTypeOf |
| 338 { | 338 { |
| 339 my $dataNode = shift; | 339 my $dataNode = shift; |
| 340 return 1 if ($dataNode->name eq "Node"); | 340 my $superType = shift; |
| 341 return 1 if ($dataNode->name eq $superType); |
| 341 foreach (@allParents) { | 342 foreach (@allParents) { |
| 342 my $parent = $codeGenerator->StripModule($_); | 343 my $parent = $codeGenerator->StripModule($_); |
| 343 return 1 if $parent eq "Node"; | 344 return 1 if $parent eq $superType; |
| 344 } | 345 } |
| 345 return 0; | 346 return 0; |
| 346 } | 347 } |
| 347 | 348 |
| 348 sub HolderToNative | 349 sub HolderToNative |
| 349 { | 350 { |
| 350 my $dataNode = shift; | 351 my $dataNode = shift; |
| 351 my $implClassName = shift; | 352 my $implClassName = shift; |
| 352 my $classIndex = shift; | 353 my $classIndex = shift; |
| 353 | 354 |
| 354 if (IsNodeSubType($dataNode)) { | 355 if (IsSubTypeOf($dataNode, "Node")) { |
| 355 push(@implContentDecls, <<END); | 356 push(@implContentDecls, <<END); |
| 356 $implClassName* imp = V8DOMWrapper::convertDOMWrapperToNode<$implClassName>(
holder); | 357 $implClassName* imp = V8DOMWrapper::convertDOMWrapperToNode<$implClassName>(
holder); |
| 357 END | 358 END |
| 358 | 359 |
| 359 } else { | 360 } else { |
| 360 push(@implContentDecls, <<END); | 361 push(@implContentDecls, <<END); |
| 361 $implClassName* imp = V8DOMWrapper::convertToNativeObject<$implClassName>(V8
ClassIndex::$classIndex, holder); | 362 $implClassName* imp = V8DOMWrapper::convertToNativeObject<$implClassName>(V8
ClassIndex::$classIndex, holder); |
| 362 END | 363 END |
| 363 | 364 |
| 364 } | 365 } |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 $getter = "${interfaceName}Internal::${interfaceName}ConstructorGett
er"; | 954 $getter = "${interfaceName}Internal::${interfaceName}ConstructorGett
er"; |
| 954 $setter = "0"; | 955 $setter = "0"; |
| 955 $propAttr = "v8::ReadOnly"; | 956 $propAttr = "v8::ReadOnly"; |
| 956 | 957 |
| 957 # EventListeners | 958 # EventListeners |
| 958 } elsif ($attribute->signature->type eq "EventListener") { | 959 } elsif ($attribute->signature->type eq "EventListener") { |
| 959 if ($interfaceName eq "DOMWindow") { | 960 if ($interfaceName eq "DOMWindow") { |
| 960 $getter = "V8Custom::v8DOMWindowEventHandlerAccessorGetter"; | 961 $getter = "V8Custom::v8DOMWindowEventHandlerAccessorGetter"; |
| 961 $setter = "V8Custom::v8DOMWindowEventHandlerAccessorSetter"; | 962 $setter = "V8Custom::v8DOMWindowEventHandlerAccessorSetter"; |
| 962 } elsif ($interfaceName eq "Element" || $interfaceName eq "Document"
|| $interfaceName eq "HTMLBodyElement" || $interfaceName eq "SVGElementInstance
" || $interfaceName eq "HTMLFrameSetElement") { | 963 } elsif ($interfaceName eq "Element" || $interfaceName eq "Document"
|| $interfaceName eq "HTMLBodyElement" || $interfaceName eq "SVGElementInstance
" || $interfaceName eq "HTMLFrameSetElement") { |
| 963 $getter = "V8Custom::v8ElementEventHandlerAccessorGetter"; | 964 $getter = "V8Custom::v8NodeEventHandlerAccessorGetter"; |
| 964 $setter = "V8Custom::v8ElementEventHandlerAccessorSetter"; | 965 $setter = "V8Custom::v8NodeEventHandlerAccessorSetter"; |
| 965 } else { | 966 } else { |
| 966 $getter = "V8Custom::v8${customAccessor}AccessorGetter"; | 967 $getter = "V8Custom::v8${customAccessor}AccessorGetter"; |
| 967 if ($interfaceName eq "WorkerContext" and $attrName eq "self") { | 968 if ($interfaceName eq "WorkerContext" and $attrName eq "self") { |
| 968 $setter = "0"; | 969 $setter = "0"; |
| 969 $propAttr = "v8::ReadOnly"; | 970 $propAttr = "v8::ReadOnly"; |
| 970 } else { | 971 } else { |
| 971 $setter = "V8Custom::v8${customAccessor}AccessorSetter"; | 972 $setter = "V8Custom::v8${customAccessor}AccessorSetter"; |
| 972 } | 973 } |
| 973 } | 974 } |
| 974 | 975 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 sizeof(shadow_attrs)/sizeof(*shadow_attrs)); | 1233 sizeof(shadow_attrs)/sizeof(*shadow_attrs)); |
| 1233 return templ; | 1234 return templ; |
| 1234 } | 1235 } |
| 1235 END | 1236 END |
| 1236 } | 1237 } |
| 1237 | 1238 |
| 1238 # Generate the template configuration method | 1239 # Generate the template configuration method |
| 1239 push(@implContent, <<END); | 1240 push(@implContent, <<END); |
| 1240 static v8::Persistent<v8::FunctionTemplate> Configure${className}Template(v8::Pe
rsistent<v8::FunctionTemplate> desc) { | 1241 static v8::Persistent<v8::FunctionTemplate> Configure${className}Template(v8::Pe
rsistent<v8::FunctionTemplate> desc) { |
| 1241 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); | 1242 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); |
| 1242 instance->SetInternalFieldCount(2); | 1243 END |
| 1244 if (IsSubTypeOf($dataNode, "Node")) { |
| 1245 push(@implContent, <<END); |
| 1246 instance->SetInternalFieldCount(V8Custom::kNodeMinimumInternalFieldCount); |
| 1247 END |
| 1248 } else { |
| 1249 push(@implContent, <<END); |
| 1250 instance->SetInternalFieldCount(V8Custom::kDefaultWrapperInternalFieldCount); |
| 1251 END |
| 1252 } |
| 1253 |
| 1254 push(@implContent, <<END); |
| 1243 v8::Local<v8::Signature> default_signature = v8::Signature::New(desc); | 1255 v8::Local<v8::Signature> default_signature = v8::Signature::New(desc); |
| 1244 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); | 1256 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); |
| 1245 $access_check | 1257 $access_check |
| 1246 END | 1258 END |
| 1247 | 1259 |
| 1248 | 1260 |
| 1249 # Set up our attributes if we have them | 1261 # Set up our attributes if we have them |
| 1250 if ($has_attributes) { | 1262 if ($has_attributes) { |
| 1251 push(@implContent, <<END); | 1263 push(@implContent, <<END); |
| 1252 batchConfigureAttributes(instance, proto, ${interfaceName}_attrs, sizeof(${int
erfaceName}_attrs)/sizeof(*${interfaceName}_attrs)); | 1264 batchConfigureAttributes(instance, proto, ${interfaceName}_attrs, sizeof(${int
erfaceName}_attrs)/sizeof(*${interfaceName}_attrs)); |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 return 0; | 2201 return 0; |
| 2190 } | 2202 } |
| 2191 | 2203 |
| 2192 sub DebugPrint | 2204 sub DebugPrint |
| 2193 { | 2205 { |
| 2194 my $output = shift; | 2206 my $output = shift; |
| 2195 | 2207 |
| 2196 print $output; | 2208 print $output; |
| 2197 print "\n"; | 2209 print "\n"; |
| 2198 } | 2210 } |
| OLD | NEW |