| 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, 2007 Samuel Weinig <sam@webkit.org> | 4 # Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> |
| 5 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 5 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
| 6 # Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 # Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 # | 7 # |
| 8 # This library is free software; you can redistribute it and/or | 8 # This library is free software; you can redistribute it and/or |
| 9 # modify it under the terms of the GNU Library General Public | 9 # modify it under the terms of the GNU Library General Public |
| 10 # License as published by the Free Software Foundation; either | 10 # License as published by the Free Software Foundation; either |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 338 |
| 339 sub GetParentImplClassName | 339 sub GetParentImplClassName |
| 340 { | 340 { |
| 341 my $dataNode = shift; | 341 my $dataNode = shift; |
| 342 | 342 |
| 343 return "Object" if @{$dataNode->parents} eq 0; | 343 return "Object" if @{$dataNode->parents} eq 0; |
| 344 | 344 |
| 345 my $parent = $codeGenerator->StripModule($dataNode->parents(0)); | 345 my $parent = $codeGenerator->StripModule($dataNode->parents(0)); |
| 346 | 346 |
| 347 # special cases | 347 # special cases |
| 348 return "Node" if $parent eq "EventTargetNode"; |
| 348 return "Object" if $parent eq "HTMLCollection"; | 349 return "Object" if $parent eq "HTMLCollection"; |
| 349 | 350 |
| 350 return $parent; | 351 return $parent; |
| 351 } | 352 } |
| 352 | 353 |
| 353 sub GetParentAndProtocols | 354 sub GetParentAndProtocols |
| 354 { | 355 { |
| 355 my $dataNode = shift; | 356 my $dataNode = shift; |
| 356 my $numParents = @{$dataNode->parents}; | 357 my $numParents = @{$dataNode->parents}; |
| 357 | 358 |
| 358 my $parent = ""; | 359 my $parent = ""; |
| 359 my @protocols = (); | 360 my @protocols = (); |
| 360 if ($numParents eq 0) { | 361 if ($numParents eq 0) { |
| 361 if ($isProtocol) { | 362 if ($isProtocol) { |
| 362 push(@protocols, "NSObject"); | 363 push(@protocols, "NSObject"); |
| 363 push(@protocols, "NSCopying") if $dataNode->name eq "EventTarget"; | 364 push(@protocols, "NSCopying") if $dataNode->name eq "EventTarget"; |
| 364 } else { | 365 } else { |
| 365 $parent = "DOMObject"; | 366 $parent = "DOMObject"; |
| 366 } | 367 } |
| 367 } elsif ($numParents eq 1) { | 368 } elsif ($numParents eq 1) { |
| 368 my $parentName = $codeGenerator->StripModule($dataNode->parents(0)); | 369 my $parentName = $codeGenerator->StripModule($dataNode->parents(0)); |
| 369 if ($isProtocol) { | 370 if ($isProtocol) { |
| 370 die "Parents of protocols must also be protocols." unless IsProtocol
Type($parentName); | 371 die "Parents of protocols must also be protocols." unless IsProtocol
Type($parentName); |
| 371 push(@protocols, "DOM" . $parentName); | 372 push(@protocols, "DOM" . $parentName); |
| 372 } else { | 373 } else { |
| 373 if (IsProtocolType($parentName)) { | 374 if (IsProtocolType($parentName)) { |
| 374 push(@protocols, "DOM" . $parentName); | 375 push(@protocols, "DOM" . $parentName); |
| 376 } elsif ($parentName eq "EventTargetNode") { |
| 377 $parent = "DOMNode"; |
| 375 } elsif ($parentName eq "HTMLCollection") { | 378 } elsif ($parentName eq "HTMLCollection") { |
| 376 $parent = "DOMObject"; | 379 $parent = "DOMObject"; |
| 377 } else { | 380 } else { |
| 378 $parent = "DOM" . $parentName; | 381 $parent = "DOM" . $parentName; |
| 379 } | 382 } |
| 380 } | 383 } |
| 381 } else { | 384 } else { |
| 382 my @parents = @{$dataNode->parents}; | 385 my @parents = @{$dataNode->parents}; |
| 383 my $firstParent = $codeGenerator->StripModule(shift(@parents)); | 386 my $firstParent = $codeGenerator->StripModule(shift(@parents)); |
| 384 if (IsProtocolType($firstParent)) { | 387 if (IsProtocolType($firstParent)) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 # put into the form "_fooBar" for type FooBar. | 500 # put into the form "_fooBar" for type FooBar. |
| 498 return "_" . $typeGetter; | 501 return "_" . $typeGetter; |
| 499 } | 502 } |
| 500 | 503 |
| 501 sub GetObjCTypeGetter | 504 sub GetObjCTypeGetter |
| 502 { | 505 { |
| 503 my $argName = shift; | 506 my $argName = shift; |
| 504 my $type = $codeGenerator->StripModule(shift); | 507 my $type = $codeGenerator->StripModule(shift); |
| 505 | 508 |
| 506 return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator-
>IsStringType($type) or IsNativeObjCType($type); | 509 return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator-
>IsStringType($type) or IsNativeObjCType($type); |
| 507 return $argName . "Node" if $type eq "EventTarget"; | 510 return $argName . "EventTarget" if $type eq "EventTarget"; |
| 508 return "static_cast<WebCore::Range::CompareHow>($argName)" if $type eq "Comp
areHow"; | 511 return "static_cast<WebCore::Range::CompareHow>($argName)" if $type eq "Comp
areHow"; |
| 509 return "static_cast<WebCore::SVGPaint::SVGPaintType>($argName)" if $type eq
"SVGPaintType"; | 512 return "static_cast<WebCore::SVGPaint::SVGPaintType>($argName)" if $type eq
"SVGPaintType"; |
| 510 | 513 |
| 511 my $typeGetterMethodName = GetObjCTypeGetterName($type); | 514 my $typeGetterMethodName = GetObjCTypeGetterName($type); |
| 512 | 515 |
| 513 return "WTF::getPtr(nativeEventListener)" if $type eq "EventListener"; | 516 return "WTF::getPtr(nativeEventListener)" if $type eq "EventListener"; |
| 514 return "WTF::getPtr(nativeNodeFilter)" if $type eq "NodeFilter"; | 517 return "WTF::getPtr(nativeNodeFilter)" if $type eq "NodeFilter"; |
| 515 return "WTF::getPtr(nativeResolver)" if $type eq "XPathNSResolver"; | 518 return "WTF::getPtr(nativeResolver)" if $type eq "XPathNSResolver"; |
| 516 return "[$argName $typeGetterMethodName]"; | 519 return "[$argName $typeGetterMethodName]"; |
| 517 } | 520 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 return; | 616 return; |
| 614 } | 617 } |
| 615 | 618 |
| 616 if ($type eq "DOMImplementation") { | 619 if ($type eq "DOMImplementation") { |
| 617 $implIncludes{"DOMImplementationFront.h"} = 1; | 620 $implIncludes{"DOMImplementationFront.h"} = 1; |
| 618 $implIncludes{"DOM$type.h"} = 1; | 621 $implIncludes{"DOM$type.h"} = 1; |
| 619 return; | 622 return; |
| 620 } | 623 } |
| 621 | 624 |
| 622 if ($type eq "EventTarget") { | 625 if ($type eq "EventTarget") { |
| 623 $implIncludes{"Node.h"} = 1; | 626 $implIncludes{"EventTargetNode.h"} = 1; |
| 624 $implIncludes{"DOM$type.h"} = 1; | 627 $implIncludes{"DOM$type.h"} = 1; |
| 625 return; | 628 return; |
| 626 } | 629 } |
| 627 | 630 |
| 628 if ($codeGenerator->IsSVGAnimatedType($type)) { | 631 if ($codeGenerator->IsSVGAnimatedType($type)) { |
| 629 $implIncludes{"SVGAnimatedTemplate.h"} = 1; | 632 $implIncludes{"SVGAnimatedTemplate.h"} = 1; |
| 630 $implIncludes{"DOM$type.h"} = 1; | 633 $implIncludes{"DOM$type.h"} = 1; |
| 631 return; | 634 return; |
| 632 } | 635 } |
| 633 | 636 |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 push(@functionContent, " nativeResolver = WTF::getPtr
(customResolver);\n"); | 1399 push(@functionContent, " nativeResolver = WTF::getPtr
(customResolver);\n"); |
| 1397 push(@functionContent, " }\n"); | 1400 push(@functionContent, " }\n"); |
| 1398 push(@functionContent, " }\n"); | 1401 push(@functionContent, " }\n"); |
| 1399 } | 1402 } |
| 1400 | 1403 |
| 1401 # special case the EventTarget | 1404 # special case the EventTarget |
| 1402 if (defined $needsCustom{"EventTarget"}) { | 1405 if (defined $needsCustom{"EventTarget"}) { |
| 1403 my $paramName = $needsCustom{"EventTarget"}; | 1406 my $paramName = $needsCustom{"EventTarget"}; |
| 1404 push(@functionContent, " DOMNode* ${paramName}ObjC = $paramNa
me;\n"); | 1407 push(@functionContent, " DOMNode* ${paramName}ObjC = $paramNa
me;\n"); |
| 1405 push(@functionContent, " WebCore::Node* ${paramName}Node = [$
{paramName}ObjC _node];\n"); | 1408 push(@functionContent, " WebCore::Node* ${paramName}Node = [$
{paramName}ObjC _node];\n"); |
| 1409 push(@functionContent, " WebCore::EventTargetNode* ${paramNam
e}EventTarget = (${paramName}Node && ${paramName}Node->isEventTargetNode()) ? st
atic_cast<WebCore::EventTargetNode*>(${paramName}Node) : 0;\n\n"); |
| 1406 $implIncludes{"DOMNode.h"} = 1; | 1410 $implIncludes{"DOMNode.h"} = 1; |
| 1407 $implIncludes{"Node.h"} = 1; | 1411 $implIncludes{"Node.h"} = 1; |
| 1408 } | 1412 } |
| 1409 | 1413 |
| 1410 if ($function->signature->extendedAttributes->{"UsesView"}) { | 1414 if ($function->signature->extendedAttributes->{"UsesView"}) { |
| 1411 push(@functionContent, " WebCore::DOMWindow* dv = $caller->de
faultView();\n"); | 1415 push(@functionContent, " WebCore::DOMWindow* dv = $caller->de
faultView();\n"); |
| 1412 push(@functionContent, " if (!dv)\n"); | 1416 push(@functionContent, " if (!dv)\n"); |
| 1413 push(@functionContent, " return nil;\n"); | 1417 push(@functionContent, " return nil;\n"); |
| 1414 $implIncludes{"DOMWindow.h"} = 1; | 1418 $implIncludes{"DOMWindow.h"} = 1; |
| 1415 $caller = "dv"; | 1419 $caller = "dv"; |
| 1416 } | 1420 } |
| 1417 | 1421 |
| 1422 if ($function->signature->extendedAttributes->{"EventTargetNodeCast"
}) { |
| 1423 if ($dataNode->name =~ /^SVG/) { |
| 1424 $caller = "static_cast<WebCore::SVGElementInstance*>($caller
)"; |
| 1425 } else { |
| 1426 push(@functionContent, " if (!$caller->isEventTargetNode(
))\n"); |
| 1427 $caller = "WebCore::EventTargetNodeCast($caller)"; |
| 1428 push(@functionContent, " WebCore::raiseDOMException(D
OM_NOT_SUPPORTED_ERR);\n"); |
| 1429 } |
| 1430 } |
| 1431 |
| 1418 # special case the EventListener | 1432 # special case the EventListener |
| 1419 if (defined $needsCustom{"EventListener"}) { | 1433 if (defined $needsCustom{"EventListener"}) { |
| 1420 my $paramName = $needsCustom{"EventListener"}; | 1434 my $paramName = $needsCustom{"EventListener"}; |
| 1421 push(@functionContent, " RefPtr<WebCore::EventListener> nativ
eEventListener = WebCore::ObjCEventListener::wrap($paramName);\n"); | 1435 push(@functionContent, " RefPtr<WebCore::EventListener> nativ
eEventListener = WebCore::ObjCEventListener::wrap($paramName);\n"); |
| 1422 } | 1436 } |
| 1423 | 1437 |
| 1424 # special case the NodeFilter | 1438 # special case the NodeFilter |
| 1425 if (defined $needsCustom{"NodeFilter"}) { | 1439 if (defined $needsCustom{"NodeFilter"}) { |
| 1426 my $paramName = $needsCustom{"NodeFilter"}; | 1440 my $paramName = $needsCustom{"NodeFilter"}; |
| 1427 push(@functionContent, " RefPtr<WebCore::NodeFilter> nativeNo
deFilter;\n"); | 1441 push(@functionContent, " RefPtr<WebCore::NodeFilter> nativeNo
deFilter;\n"); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 | 1722 |
| 1709 print INTERNAL_HEADER @internalHeaderContent; | 1723 print INTERNAL_HEADER @internalHeaderContent; |
| 1710 | 1724 |
| 1711 close(INTERNAL_HEADER); | 1725 close(INTERNAL_HEADER); |
| 1712 | 1726 |
| 1713 @internalHeaderContent = (); | 1727 @internalHeaderContent = (); |
| 1714 } | 1728 } |
| 1715 } | 1729 } |
| 1716 | 1730 |
| 1717 1; | 1731 1; |
| OLD | NEW |