Index: third_party/WebKit/WebCore/bindings/scripts/CodeGeneratorObjC.pm |
=================================================================== |
--- third_party/WebKit/WebCore/bindings/scripts/CodeGeneratorObjC.pm (revision 9383) |
+++ third_party/WebKit/WebCore/bindings/scripts/CodeGeneratorObjC.pm (working copy) |
@@ -345,6 +345,7 @@ |
my $parent = $codeGenerator->StripModule($dataNode->parents(0)); |
# special cases |
+ return "Node" if $parent eq "EventTargetNode"; |
return "Object" if $parent eq "HTMLCollection"; |
return $parent; |
@@ -372,6 +373,8 @@ |
} else { |
if (IsProtocolType($parentName)) { |
push(@protocols, "DOM" . $parentName); |
+ } elsif ($parentName eq "EventTargetNode") { |
+ $parent = "DOMNode"; |
} elsif ($parentName eq "HTMLCollection") { |
$parent = "DOMObject"; |
} else { |
@@ -504,7 +507,7 @@ |
my $type = $codeGenerator->StripModule(shift); |
return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator->IsStringType($type) or IsNativeObjCType($type); |
- return $argName . "Node" if $type eq "EventTarget"; |
+ return $argName . "EventTarget" if $type eq "EventTarget"; |
return "static_cast<WebCore::Range::CompareHow>($argName)" if $type eq "CompareHow"; |
return "static_cast<WebCore::SVGPaint::SVGPaintType>($argName)" if $type eq "SVGPaintType"; |
@@ -620,7 +623,7 @@ |
} |
if ($type eq "EventTarget") { |
- $implIncludes{"Node.h"} = 1; |
+ $implIncludes{"EventTargetNode.h"} = 1; |
$implIncludes{"DOM$type.h"} = 1; |
return; |
} |
@@ -1403,6 +1406,7 @@ |
my $paramName = $needsCustom{"EventTarget"}; |
push(@functionContent, " DOMNode* ${paramName}ObjC = $paramName;\n"); |
push(@functionContent, " WebCore::Node* ${paramName}Node = [${paramName}ObjC _node];\n"); |
+ push(@functionContent, " WebCore::EventTargetNode* ${paramName}EventTarget = (${paramName}Node && ${paramName}Node->isEventTargetNode()) ? static_cast<WebCore::EventTargetNode*>(${paramName}Node) : 0;\n\n"); |
$implIncludes{"DOMNode.h"} = 1; |
$implIncludes{"Node.h"} = 1; |
} |
@@ -1415,6 +1419,16 @@ |
$caller = "dv"; |
} |
+ if ($function->signature->extendedAttributes->{"EventTargetNodeCast"}) { |
+ if ($dataNode->name =~ /^SVG/) { |
+ $caller = "static_cast<WebCore::SVGElementInstance*>($caller)"; |
+ } else { |
+ push(@functionContent, " if (!$caller->isEventTargetNode())\n"); |
+ $caller = "WebCore::EventTargetNodeCast($caller)"; |
+ push(@functionContent, " WebCore::raiseDOMException(DOM_NOT_SUPPORTED_ERR);\n"); |
+ } |
+ } |
+ |
# special case the EventListener |
if (defined $needsCustom{"EventListener"}) { |
my $paramName = $needsCustom{"EventListener"}; |