OSDN Git Service

Merge WebKit at r72274: Fix CodeGeneratorV8.pm
[android-x86/external-webkit.git] / WebCore / bindings / scripts / CodeGeneratorV8.pm
index 06bce04..6f39582 100644 (file)
@@ -1,4 +1,3 @@
-
 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
@@ -6,6 +5,7 @@
 # Copyright (C) 2006 Apple Computer, Inc.
 # Copyright (C) 2007, 2008, 2009 Google Inc.
 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
+# Copyright (C) Research In Motion Limited 2010. All rights reserved.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -38,6 +38,7 @@ my @implFixedHeader = ();
 my @implContent = ();
 my @implContentDecls = ();
 my %implIncludes = ();
+my %headerIncludes = ();
 
 my @allParents = ();
 
@@ -86,13 +87,6 @@ sub finish
     $object->WriteData();
 }
 
-# Workaround for V8 bindings difference where RGBColor is not a POD type.
-sub IsPodType
-{
-    my $type = shift;
-    return $codeGenerator->IsPodType($type);
-}
-
 # Params: 'domClass' struct
 sub GenerateInterface
 {
@@ -128,22 +122,13 @@ sub GenerateModule
     $module = $dataNode->module;
 }
 
-sub AvoidInclusionOfType
-{
-    my $type = shift;
-
-    # Special case: SVGRect.h / SVGPoint.h / SVGNumber.h / SVGMatrix.h do not exist.
-    return 1 if $type eq "SVGRect" or $type eq "SVGPoint" or $type eq "SVGNumber" or $type eq "SVGMatrix";
-    return 0;
-}
-
 sub AddIncludesForType
 {
     my $type = $codeGenerator->StripModule(shift);
 
     # When we're finished with the one-file-per-class
     # reorganization, we won't need these special cases.
-    if (!$codeGenerator->IsPrimitiveType($type) and !AvoidInclusionOfType($type) and $type ne "Date") {
+    if (!$codeGenerator->IsPrimitiveType($type) and !$codeGenerator->AvoidInclusionOfType($type) and $type ne "Date") {
         # default, include the same named file
         $implIncludes{GetV8HeaderName(${type})} = 1;
 
@@ -176,20 +161,6 @@ sub AddIncludesForType
     }
 }
 
-sub AddIncludesForSVGAnimatedType
-{
-    my $type = shift;
-    $type =~ s/SVGAnimated//;
-
-    if ($type eq "Point" or $type eq "Rect") {
-        $implIncludes{"Float$type.h"} = 1;
-    } elsif ($type eq "String") {
-        $implIncludes{"PlatformString.h"} = 1;
-    }
-
-    $implIncludes{"SVGAnimatedTemplate.h"} = 1;
-}
-
 # If the node has a [Conditional=XXX] attribute, returns an "ENABLE(XXX)" string for use in an #if.
 sub GenerateConditionalString
 {
@@ -208,6 +179,45 @@ sub GenerateConditionalString
     }
 }
 
+sub GetSVGPropertyTypes
+{
+    my $implType = shift;
+
+    my $svgPropertyType;
+    my $svgListPropertyType;
+    my $svgNativeType;
+
+    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $implType =~ /SVG/;
+
+    $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implType);
+    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $svgNativeType;
+
+    # Append space to avoid compilation errors when using  PassRefPtr<$svgNativeType>
+    $svgNativeType = "$svgNativeType ";
+
+    my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implType);
+    if ($svgNativeType =~ /SVGPropertyTearOff/) {
+        $svgPropertyType = $svgWrappedNativeType;
+        $implIncludes{"SVGAnimatedPropertyTearOff.h"} = 1;
+    } elsif ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SVGStaticListPropertyTearOff/) {
+        $svgListPropertyType = $svgWrappedNativeType;
+        $implIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1;
+    } elsif ($svgNativeType =~ /SVGTransformListPropertyTearOff/) {
+        $svgListPropertyType = $svgWrappedNativeType;
+        $headerIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1;
+        $headerIncludes{"SVGTransformListPropertyTearOff.h"} = 1;
+    } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) {
+        $svgListPropertyType = $svgWrappedNativeType;
+        $headerIncludes{"SVGPathSegListPropertyTearOff.h"} = 1;
+    }
+
+    if ($svgPropertyType) {
+        $svgPropertyType = "SVGPoint" if $svgPropertyType eq "FloatPoint";
+    }
+
+    return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
+}
+
 sub GenerateHeader
 {
     my $object = shift;
@@ -226,35 +236,35 @@ sub GenerateHeader
     # - Add default header template
     push(@headerContent, GenerateHeaderContentHeader($dataNode));
 
-    # Get correct pass/store types respecting PODType flag
-    my $podType = $dataNode->extendedAttributes->{"PODType"};
-
-    my %headerInclues = ();
-    $headerIncludes{"$podType.h"} = 1 if $podType and ($podType ne "double" and $podType ne "float" and $podType ne "RGBA32");
     $headerIncludes{"wtf/text/StringHash.h"} = 1;
     $headerIncludes{"WrapperTypeInfo.h"} = 1;
     $headerIncludes{"V8DOMWrapper.h"} = 1;
+
     my $headerClassInclude = GetHeaderClassInclude($implClassName);
     $headerIncludes{$headerClassInclude} = 1 if $headerClassInclude ne "";
 
+    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implClassName);
+
     foreach my $headerInclude (sort keys(%headerIncludes)) {
         push(@headerContent, "#include \"${headerInclude}\"\n");
     }
 
     push(@headerContent, "#include <v8.h>\n");
     push(@headerContent, "#include <wtf/HashMap.h>\n");
-    
+
     push(@headerContent, "\nnamespace WebCore {\n");
-    if ($podType) {
-        push(@headerContent, "\ntemplate<typename PODType> class V8SVGPODTypeWrapper;\n");
+    push(@headerContent, "\ntemplate<typename PropertyType> class SVGPropertyTearOff;\n") if $svgPropertyType;
+    if ($svgNativeType) {
+        if ($svgNativeType =~ /SVGStaticListPropertyTearOff/) {
+            push(@headerContent, "\ntemplate<typename PropertyType> class SVGStaticListPropertyTearOff;\n");
+        } else {
+            push(@headerContent, "\ntemplate<typename PropertyType> class SVGListPropertyTearOff;\n");
+        }
     }
+    push(@headerContent, "\nclass FloatRect;\n") if $svgPropertyType && $svgPropertyType eq "FloatRect";
     push(@headerContent, "\nclass $className {\n");
 
-    my $nativeType = GetNativeTypeForConversions($interfaceName);
-    if ($podType) {
-        $nativeType = "V8SVGPODTypeWrapper<${nativeType} >";
-    }
-
+    my $nativeType = GetNativeTypeForConversions($dataNode, $interfaceName);
     my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName);
     my $forceNewObjectParameter = IsDOMNodeType($interfaceName) ? ", bool forceNewObject = false" : "";
     my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : "";
@@ -449,8 +459,7 @@ sub GetHeaderClassInclude
     if ($className =~ /SVGPathSeg/) {
         $className =~ s/Abs|Rel//;
     }
-    return "" if (AvoidInclusionOfType($className));
-    return "SVGAnimatedTemplate.h" if ($codeGenerator->IsSVGAnimatedType($className));
+    return "" if ($codeGenerator->AvoidInclusionOfType($className));
     return "${className}.h";
 }
 
@@ -496,7 +505,7 @@ sub GenerateHeaderNamedAndIndexedPropertyAccessors
         $hasCustomDeleterr = 0;
         $hasEnumerator = 0;
     }
-    if ($interfaceName eq "HTMLSelectElement" || $interfaceName eq "HTMLAppletElement" || $interfaceName eq "HTMLEmbedElement" || $interfaceName eq "HTMLObjectElement") {
+    if ($interfaceName eq "HTMLAppletElement" || $interfaceName eq "HTMLEmbedElement" || $interfaceName eq "HTMLObjectElement") {
         $hasCustomNamedGetter = 1;
     }
     if ($interfaceName eq "HTMLDocument") {
@@ -676,35 +685,17 @@ sub GenerateNormalAttrGetter
     my $attrName = $attribute->signature->name;
 
     my $attrType = GetTypeFromSignature($attribute->signature);
-    my $attrIsPodType = IsPodType($attrType);
 
     my $nativeType = GetNativeTypeFromSignature($attribute->signature, -1);
-    my $isPodType = IsPodType($implClassName);
     my $skipContext = 0;
 
-    if ($isPodType) {
-        $implClassName = GetNativeType($implClassName);
-        $implIncludes{"V8SVGPODTypeWrapper.h"} = 1;
-    }
-
     # Special case: SVGZoomEvent's attributes are all read-only
     if ($implClassName eq "SVGZoomEvent") {
-        $attrIsPodType = 0;
-        $skipContext = 1;
-    }
-
-    # Special case: SVGSVGEelement::viewport is read-only
-    if (($implClassName eq "SVGSVGElement") and ($attrName eq "viewport")) {
-        $attrIsPodType = 0;
         $skipContext = 1;
     }
 
-    # Special case for SVGColor
-    if (($implClassName eq "SVGColor") and ($attrName eq "rgbColor")) {
-        $attrIsPodType = 0;
-    }
-
-    my $getterStringUsesImp = $implClassName ne "float";
+    my $getterStringUsesImp = $implClassName ne "SVGNumber";
+    my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implClassName);
 
     # Getter
     my $conditionalString = GenerateConditionalString($attribute->signature);
@@ -716,17 +707,23 @@ static v8::Handle<v8::Value> ${attrName}AttrGetter(v8::Local<v8::String> name, c
     INC_STATS(\"DOM.$implClassName.$attrName._get\");
 END
 
-    if ($isPodType) {
-        push(@implContentDecls, <<END);
-    V8SVGPODTypeWrapper<$implClassName>* impWrapper = V8SVGPODTypeWrapper<$implClassName>::toNative(info.Holder());
-    $implClassName impInstance = *impWrapper;
+    if ($svgNativeType) {
+        my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName);
+        if ($svgWrappedNativeType =~ /List/) {
+            push(@implContentDecls, <<END);
+    $svgNativeType* imp = V8${implClassName}::toNative(info.Holder());
 END
-        if ($getterStringUsesImp) {
+        } else {
             push(@implContentDecls, <<END);
-    $implClassName* imp = &impInstance;
+    $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder());
+    $svgWrappedNativeType& impInstance = wrapper->propertyReference();
+END
+            if ($getterStringUsesImp) {
+                push(@implContentDecls, <<END);
+    $svgWrappedNativeType* imp = &impInstance;
 END
+            }
         }
-
     } elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8DisallowShadowing"}) {
         if ($interfaceName eq "DOMWindow") {
             push(@implContentDecls, <<END);
@@ -769,7 +766,7 @@ END
         push(@implContentDecls, "    if (!V8BindingSecurity::checkNodeSecurity(V8BindingState::Only(), imp->contentDocument()))\n    return v8::Handle<v8::Value>();\n\n");
     }
 
-    my $useExceptions = 1 if @{$attribute->getterExceptions} and !($isPodType);
+    my $useExceptions = 1 if @{$attribute->getterExceptions};
     if ($useExceptions) {
         $implIncludes{"ExceptionCode.h"} = 1;
         push(@implContentDecls, "    ExceptionCode ec = 0;\n");
@@ -793,99 +790,102 @@ END
     my $result;
     my $wrapper;
 
-    if ($attrIsPodType) {
-        $implIncludes{"V8SVGPODTypeWrapper.h"} = 1;
-
-        my $getter = $getterString;
-        $getter =~ s/imp->//;
-        $getter =~ s/\(\)//;
-        my $setter = "set" . $codeGenerator->WK_ucfirst($getter);
-
-        my $implClassIsAnimatedType = $codeGenerator->IsSVGAnimatedType($implClassName);
-        if (not $implClassIsAnimatedType and $codeGenerator->IsPodTypeWithWriteableProperties($attrType) and not defined $attribute->signature->extendedAttributes->{"Immutable"}) {
-            if (IsPodType($implClassName)) {
-                my $wrapper = "V8SVGStaticPODTypeWrapperWithPODTypeParent<$nativeType, $implClassName>::create($getterString, impWrapper)";
-                push(@implContentDecls, "    RefPtr<V8SVGStaticPODTypeWrapperWithPODTypeParent<$nativeType, $implClassName> > wrapper = $wrapper;\n");
-            } else {
-                my $wrapper = "V8SVGStaticPODTypeWrapperWithParent<$nativeType, $implClassName>::create(imp, &${implClassName}::$getter, &${implClassName}::$setter)";
-                push(@implContentDecls, "    RefPtr<V8SVGStaticPODTypeWrapperWithParent<$nativeType, $implClassName> > wrapper = $wrapper;\n");
-            }
-        } else {
-            if ($implClassIsAnimatedType) {
-                # We can't hash member function pointers, so instead generate
-                # some hashing material based on the names of the methods.
-                my $hashhex = substr(Digest::MD5::md5_hex("${implClassName}::$getter ${implClassName}::$setter)"), 0, 8);
-                my $wrapper = "V8SVGDynamicPODTypeWrapperCache<$nativeType, $implClassName>::lookupOrCreateWrapper(imp, &${implClassName}::$getter, &${implClassName}::$setter, 0x$hashhex)";
-                push(@implContentDecls, "    RefPtr<V8SVGPODTypeWrapper<" . $nativeType . "> > wrapper = $wrapper;\n");
-            } else {
-                my $wrapper = GenerateSVGStaticPodTypeWrapper($returnType, $getterString);
-                push(@implContentDecls, "    RefPtr<V8SVGStaticPODTypeWrapper<" . $nativeType . "> > wrapper = $wrapper;\n");
-            }
-        }
-
-    } else {
         if ($attribute->signature->type eq "EventListener" && $dataNode->name eq "DOMWindow") {
-            push(@implContentDecls, "    if (!imp->document())\n");
-            push(@implContentDecls, "        return v8::Handle<v8::Value>();\n");
-        }
+        push(@implContentDecls, "    if (!imp->document())\n");
+        push(@implContentDecls, "        return v8::Handle<v8::Value>();\n");
+    }
 
-        if ($useExceptions) {
-            if ($nativeType =~ /^V8Parameter/) {
-              push(@implContentDecls, "    " . ConvertToV8Parameter($attribute->signature, $nativeType, "v", $getterString) . ";\n");
-            } else {
-              push(@implContentDecls, "    $nativeType v = $getterString;\n");
-            }
-            push(@implContentDecls, GenerateSetDOMException("    "));
-            $result = "v";
-            $result .= ".release()" if (IsRefPtrType($returnType));
+    if ($useExceptions) {
+        if ($nativeType =~ /^V8Parameter/) {
+          push(@implContentDecls, "    " . ConvertToV8Parameter($attribute->signature, $nativeType, "v", $getterString) . ";\n");
         } else {
-            # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary
-            $result = $getterString;
+          push(@implContentDecls, "    $nativeType v = $getterString;\n");
         }
+        push(@implContentDecls, GenerateSetDOMException("    "));
+        $result = "v";
+        $result .= ".release()" if (IsRefPtrType($returnType));
+    } else {
+        # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary
+        $result = $getterString;
+    }
  
-        # Special case for readonly or Replaceable attributes (with a few exceptions). This attempts to ensure that JS wrappers don't get
-        # garbage-collected prematurely when their lifetime is strongly tied to their owner. We accomplish this by inserting a reference to
-        # the newly created wrapper into an internal field of the holder object.
-        if (!IsNodeSubType($dataNode) && $attrName ne "self" && (IsWrapperType($returnType) && ($attribute->type =~ /^readonly/ || $attribute->signature->extendedAttributes->{"Replaceable"})
-            && $returnType ne "EventTarget" && $returnType ne "SerializedScriptValue" && $returnType ne "DOMWindow" 
-            && $returnType !~ /SVG/ && $returnType !~ /HTML/ && !IsDOMNodeType($returnType))) {
-            AddIncludesForType($returnType);
-            my $domMapFunction = GetDomMapFunction(0, $returnType);
-            # Check for a wrapper in the wrapper cache. If there is one, we know that a hidden reference has already
-            # been created. If we don't find a wrapper, we create both a wrapper and a hidden reference.
-            push(@implContentDecls, "    RefPtr<$returnType> result = ${getterString};\n");
-            push(@implContentDecls, "    v8::Handle<v8::Value> wrapper = result.get() ? ${domMapFunction}.get(result.get()) : v8::Handle<v8::Value>();\n");
-            push(@implContentDecls, "    if (wrapper.IsEmpty()) {\n");
-            push(@implContentDecls, "        wrapper = toV8(result.get());\n");
-            push(@implContentDecls, "        if (!wrapper.IsEmpty())\n");
-            if ($dataNode->name eq "DOMWindow") {
-                push(@implContentDecls, "            V8DOMWrapper::setHiddenWindowReference(imp->frame(), wrapper);\n");
-            } else {
-                push(@implContentDecls, "            V8DOMWrapper::setHiddenReference(info.Holder(), wrapper);\n");
-            }
-            push(@implContentDecls, "    }\n");
-            push(@implContentDecls, "    return wrapper;\n");
-            push(@implContentDecls, "}\n\n");
-            push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString;
-            return;
+    # Special case for readonly or Replaceable attributes (with a few exceptions). This attempts to ensure that JS wrappers don't get
+    # garbage-collected prematurely when their lifetime is strongly tied to their owner. We accomplish this by inserting a reference to
+    # the newly created wrapper into an internal field of the holder object.
+    if (!IsNodeSubType($dataNode) && $attrName ne "self" && (IsWrapperType($returnType) && ($attribute->type =~ /^readonly/ || $attribute->signature->extendedAttributes->{"Replaceable"})
+        && $returnType ne "EventTarget" && $returnType ne "SerializedScriptValue" && $returnType ne "DOMWindow" 
+        && $returnType !~ /SVG/ && $returnType !~ /HTML/ && !IsDOMNodeType($returnType))) {
+        AddIncludesForType($returnType);
+        my $domMapFunction = GetDomMapFunction(0, $returnType);
+        # Check for a wrapper in the wrapper cache. If there is one, we know that a hidden reference has already
+        # been created. If we don't find a wrapper, we create both a wrapper and a hidden reference.
+        push(@implContentDecls, "    RefPtr<$returnType> result = ${getterString};\n");
+        push(@implContentDecls, "    v8::Handle<v8::Value> wrapper = result.get() ? ${domMapFunction}.get(result.get()) : v8::Handle<v8::Value>();\n");
+        push(@implContentDecls, "    if (wrapper.IsEmpty()) {\n");
+        push(@implContentDecls, "        wrapper = toV8(result.get());\n");
+        push(@implContentDecls, "        if (!wrapper.IsEmpty())\n");
+        if ($dataNode->name eq "DOMWindow") {
+            push(@implContentDecls, "            V8DOMWrapper::setHiddenWindowReference(imp->frame(), wrapper);\n");
+        } else {
+            push(@implContentDecls, "            V8DOMWrapper::setHiddenReference(info.Holder(), wrapper);\n");
         }
+        push(@implContentDecls, "    }\n");
+        push(@implContentDecls, "    return wrapper;\n");
+        push(@implContentDecls, "}\n\n");
+        push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString;
+        return;
     }
 
     if (IsSVGTypeNeedingContextParameter($attrType) && !$skipContext) {
-        if ($attrIsPodType) {
-            push(@implContentDecls, GenerateSVGContextAssignment($implClassName, "wrapper.get()", "    "));
+        push(@implContentDecls, GenerateSVGContextRetrieval($implClassName, "    "));
+        # The templating associated with passing withSVGContext()'s return value directly into toV8 can get compilers confused,
+        # so just manually set the return value to a PassRefPtr of the expected type.
+        push(@implContentDecls, "    PassRefPtr<$attrType> resultAsPassRefPtr = V8Proxy::withSVGContext($result, context);\n");
+        $result = "resultAsPassRefPtr";
+    }
+
+    if ($codeGenerator->IsSVGAnimatedType($implClassName) and $codeGenerator->IsSVGTypeNeedingTearOff($attrType)) {
+        $implIncludes{"V8$attrType.h"} = 1;
+        my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($attrType);
+        # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked.
+        push(@implContentDecls, "    return toV8(static_cast<$svgNativeType*>($result));\n");
+    } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($attrType) and not $implClassName =~ /List$/) {
+        $implIncludes{"V8$attrType.h"} = 1;
+        $implIncludes{"SVGPropertyTearOff.h"} = 1;
+        my $tearOffType = $codeGenerator->GetSVGTypeNeedingTearOff($attrType);
+        if ($codeGenerator->IsSVGTypeWithWritablePropertiesNeedingTearOff($attrType) and not defined $attribute->signature->extendedAttributes->{"Immutable"}) {
+            my $getter = $result;
+            $getter =~ s/imp->//;
+            $getter =~ s/\(\)//;
+
+            my $updateMethod = "&${implClassName}::update" . $codeGenerator->WK_ucfirst($getter);
+
+            my $selfIsTearOffType = $codeGenerator->IsSVGTypeNeedingTearOff($implClassName);
+            if ($selfIsTearOffType) {
+                $implIncludes{"SVGStaticPropertyWithParentTearOff.h"} = 1;
+                $tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyWithParentTearOff<$implClassName, /;
+
+                if ($result =~ /matrix/ and $implClassName eq "SVGTransform") {
+                    # SVGTransform offers a matrix() method for internal usage that returns an AffineTransform
+                    # and a svgMatrix() method returning a SVGMatrix, used for the bindings.
+                    $result =~ s/matrix/svgMatrix/;
+                }
+
+                push(@implContentDecls, "    return toV8(WTF::getPtr(${tearOffType}::create(wrapper, $result, $updateMethod)));\n");
+            } else {
+                $implIncludes{"SVGStaticPropertyTearOff.h"} = 1;
+                $tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$implClassName, /;
+
+                push(@implContentDecls, "    return toV8(WTF::getPtr(${tearOffType}::create(imp, $result, $updateMethod)));\n");
+            }
+        } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
+            my $extraImp = "GetOwnerElementForType<$implClassName, IsDerivedFromSVGElement<$implClassName>::value>::ownerElement(imp), ";
+            push(@implContentDecls, "    return toV8(WTF::getPtr(${tearOffType}::create($extraImp$result)));\n");
+        } elsif ($tearOffType =~ /SVGPointList/) {
+            push(@implContentDecls, "    return toV8(WTF::getPtr($result));\n");
         } else {
-            push(@implContentDecls, GenerateSVGContextRetrieval($implClassName, "    "));
-            # The templating associated with passing withSVGContext()'s return value directly into toV8 can get compilers confused,
-            # so just manually set the return value to a PassRefPtr of the expected type.
-            push(@implContentDecls, "    PassRefPtr<$attrType> resultAsPassRefPtr = V8Proxy::withSVGContext($result, context);\n");
-            $result = "resultAsPassRefPtr";
+            push(@implContentDecls, "    return toV8(WTF::getPtr(${tearOffType}::create($result)));\n");
         }
-    }
-
-    if ($attrIsPodType) {
-        $implIncludes{"V8${attrType}.h"} = 1;
-        push(@implContentDecls, "    return toV8(wrapper.release().get());\n");
     } else {
         push(@implContentDecls, "    " . ReturnNativeToJSValue($attribute->signature, $result, "    ").";\n");
     }
@@ -911,15 +911,35 @@ sub GenerateNormalAttrSetter
     push(@implContentDecls, "static void ${attrName}AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n{\n");
     push(@implContentDecls, "    INC_STATS(\"DOM.$implClassName.$attrName._set\");\n");
 
-    my $isPodType = IsPodType($implClassName);
-
-    if ($isPodType) {
-        $implClassName = GetNativeType($implClassName);
-        $implIncludes{"V8SVGPODTypeWrapper.h"} = 1;
-        push(@implContentDecls, "    V8SVGPODTypeWrapper<$implClassName>* wrapper = V8SVGPODTypeWrapper<$implClassName>::toNative(info.Holder());\n");
-        push(@implContentDecls, "    $implClassName impInstance = *wrapper;\n");
-        push(@implContentDecls, "    $implClassName* imp = &impInstance;\n");
+    # If the "StrictTypeChecking" extended attribute is present, and the attribute's type is an
+    # interface type, then if the incoming value does not implement that interface, a TypeError is
+    # thrown rather than silently passing NULL to the C++ code.
+    # Per the Web IDL and ECMAScript specifications, incoming values can always be converted to both
+    # strings and numbers, so do not throw TypeError if the attribute is of these types.
+    if ($attribute->signature->extendedAttributes->{"StrictTypeChecking"}) {
+        my $argType = GetTypeFromSignature($attribute->signature);
+        if (IsWrapperType($argType)) {
+            push(@implContentDecls, "    if (!isUndefinedOrNull(value) && !V8${argType}::HasInstance(value)) {\n");
+            push(@implContentDecls, "        V8Proxy::throwTypeError();\n");
+            push(@implContentDecls, "        return;\n");
+            push(@implContentDecls, "    }\n");
+        }
+    }
 
+    my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implClassName);
+    if ($svgNativeType) {
+        my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName);
+        if ($svgWrappedNativeType =~ /List$/) {
+            push(@implContentDecls, <<END);
+    $svgNativeType* imp = V8${implClassName}::toNative(info.Holder());
+END
+        } else {
+            push(@implContentDecls, <<END);
+    $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder());
+    $svgWrappedNativeType& impInstance = wrapper->propertyReference();
+    $svgWrappedNativeType* imp = &impInstance;
+END
+        }
     } elsif ($attrExt->{"v8OnProto"}) {
       if ($interfaceName eq "DOMWindow") {
         push(@implContentDecls, <<END);
@@ -977,14 +997,14 @@ END
         $result = "WTF::getPtr(" . $result . ")";
     }
 
-    my $useExceptions = 1 if @{$attribute->setterExceptions} and !($isPodType);
+    my $useExceptions = 1 if @{$attribute->setterExceptions};
 
     if ($useExceptions) {
         $implIncludes{"ExceptionCode.h"} = 1;
         push(@implContentDecls, "    ExceptionCode ec = 0;\n");
     }
 
-    if ($implClassName eq "float") {
+    if ($implClassName eq "SVGNumber") {
         push(@implContentDecls, "    *imp = $result;\n");
     } else {
         if ($attribute->signature->type eq "EventListener") {
@@ -1011,17 +1031,16 @@ END
         push(@implContentDecls, "        V8Proxy::setDOMException(ec);\n");
     }
 
-    if ($isPodType) {
-        push(@implContentDecls, "    wrapper->commitChange(*imp, V8Proxy::svgContext(wrapper));\n");
+    if ($svgNativeType) {
+        if ($useExceptions) {
+            push(@implContentDecls, "    if (!ec)\n");
+            push(@implContentDecls, "        wrapper->commitChange();\n");
+        } else {
+            push(@implContentDecls, "    wrapper->commitChange();\n");
+        }
     } elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
         $implIncludes{"SVGElement.h"} = 1;
-
-        my $currentObject = "imp";
-        if ($isPodType) {
-            $currentObject = "wrapper";
-        }
-
-        push(@implContentDecls, "    if (SVGElement* context = V8Proxy::svgContext($currentObject))\n");
+        push(@implContentDecls, "    if (SVGElement* context = V8Proxy::svgContext(imp))\n");
         push(@implContentDecls, "        context->svgAttributeChanged(imp->associatedAttributeName());\n");
     }
 
@@ -1213,11 +1232,18 @@ END
         }
     }
 
-    if (IsPodType($implClassName)) {
-        my $nativeClassName = GetNativeType($implClassName);
-        push(@implContentDecls, "    V8SVGPODTypeWrapper<$nativeClassName>* impWrapper = V8SVGPODTypeWrapper<$nativeClassName>::toNative(args.Holder());\n");
-        push(@implContentDecls, "    $nativeClassName impInstance = *impWrapper;\n");
-        push(@implContentDecls, "    $nativeClassName* imp = &impInstance;\n");
+    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implClassName);
+
+    if ($svgNativeType) {
+        my $nativeClassName = GetNativeType($implClassName); 
+        if ($implClassName =~ /List$/) {
+            push(@implContentDecls, "    $nativeClassName imp = V8${implClassName}::toNative(args.Holder());\n");
+        } else {
+            my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName);
+            push(@implContentDecls, "    $nativeClassName wrapper = V8${implClassName}::toNative(args.Holder());\n");
+            push(@implContentDecls, "    $svgWrappedNativeType& impInstance = wrapper->propertyReference();\n");
+            push(@implContentDecls, "    $svgWrappedNativeType* imp = &impInstance;\n");
+        }
     } elsif (!$function->signature->extendedAttributes->{"ClassMethod"}) {
         push(@implContentDecls, <<END);
     ${implClassName}* imp = V8${implClassName}::toNative(args.Holder());
@@ -1255,11 +1281,15 @@ END
 
     if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
         push(@implContentDecls, <<END);
-    OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, $numParameters));
+    OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, $numParameters));
+    size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
+    OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
     if (!callStack)
         return v8::Undefined();
 END
+        $implIncludes{"ScriptArguments.h"} = 1;
         $implIncludes{"ScriptCallStack.h"} = 1;
+        $implIncludes{"ScriptCallStackFactory.h"} = 1;
     }
     if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"}) {
         push(@implContentDecls, <<END);
@@ -1284,10 +1314,6 @@ END
             push(@implContentDecls, "    }\n");
         }
 
-        if (BasicTypeCanFailConversion($parameter)) {
-            push(@implContentDecls, "    bool ${parameterName}Ok;\n");
-        }
-
         $implIncludes{"ExceptionCode.h"} = 1;
         my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex);
         if ($parameter->extendedAttributes->{"Callback"}) {
@@ -1313,18 +1339,22 @@ END
             push(@implContentDecls, "        return v8::Undefined();\n");
         } elsif (TypeCanFailConversion($parameter)) {
             push(@implContentDecls, "    $nativeType $parameterName = " .
-                 JSValueToNative($parameter, "args[$paramIndex]", BasicTypeCanFailConversion($parameter) ?  "${parameterName}Ok" : undef) . ";\n");
-            push(@implContentDecls, "    if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n");
+                 JSValueToNative($parameter, "args[$paramIndex]") . ";\n");
+            push(@implContentDecls, "    if (UNLIKELY(!$parameterName)) {\n");
             push(@implContentDecls, "        ec = TYPE_MISMATCH_ERR;\n");
             push(@implContentDecls, "        goto fail;\n");
             push(@implContentDecls, "    }\n");
         } elsif ($nativeType =~ /^V8Parameter/) {
-            my $value = JSValueToNative($parameter, "args[$paramIndex]", BasicTypeCanFailConversion($parameter) ?  "${parameterName}Ok" : undef);
+            my $value = JSValueToNative($parameter, "args[$paramIndex]");
             push(@implContentDecls, "    " . ConvertToV8Parameter($parameter, $nativeType, $parameterName, $value) . "\n");
         } else {
             $implIncludes{"V8BindingMacros.h"} = 1;
-            # For functions with "StrictTypeChecking", if an input parameter's type does not match the signature,
-            # a TypeError is thrown instead of casting to null.
+            # If the "StrictTypeChecking" extended attribute is present, and the argument's type is an
+            # interface type, then if the incoming value does not implement that interface, a TypeError
+            # is thrown rather than silently passing NULL to the C++ code.
+            # Per the Web IDL and ECMAScript specifications, incoming values can always be converted
+            # to both strings and numbers, so do not throw TypeError if the argument is of these
+            # types.
             if ($function->signature->extendedAttributes->{"StrictTypeChecking"}) {
                 my $argValue = "args[$paramIndex]";
                 my $argType = GetTypeFromSignature($parameter);
@@ -1333,15 +1363,10 @@ END
                     push(@implContentDecls, "        V8Proxy::throwTypeError();\n");
                     push(@implContentDecls, "        return notHandledByInterceptor();\n");
                     push(@implContentDecls, "    }\n");
-                } elsif ($codeGenerator->IsStringType($argType)) {
-                    push(@implContentDecls, "    if (args.Length() > $paramIndex && !isUndefinedOrNull($argValue) && !${argValue}->IsString() && !${argValue}->IsObject()) {\n");
-                    push(@implContentDecls, "        V8Proxy::throwTypeError();\n");
-                    push(@implContentDecls, "        return notHandledByInterceptor();\n");
-                    push(@implContentDecls, "    }\n");
                 }
             }
             push(@implContentDecls, "    EXCEPTION_BLOCK($nativeType, $parameterName, " .
-                 JSValueToNative($parameter, "args[$paramIndex]", BasicTypeCanFailConversion($parameter) ?  "${parameterName}Ok" : undef) . ");\n");
+                 JSValueToNative($parameter, "args[$paramIndex]") . ");\n");
         }
 
         if ($parameter->extendedAttributes->{"IsIndex"}) {
@@ -1609,7 +1634,7 @@ sub GenerateImplementationNamedPropertyGetter
         $hasCustomGetter = 0;
     }
 
-    my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $hasCustomGetter || $namedPropertyGetter;
+    my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $hasCustomGetter;
     if (!$hasGetter) {
         return;
     }
@@ -1681,7 +1706,6 @@ sub GenerateImplementation
     my $visibleInterfaceName = GetVisibleInterfaceName($interfaceName);
     my $className = "V8$interfaceName";
     my $implClassName = $interfaceName;
-
     my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"};
 
     # - Add default header template
@@ -1694,10 +1718,6 @@ sub GenerateImplementation
     $implIncludes{"V8DOMWrapper.h"} = 1;
     $implIncludes{"V8IsolatedContext.h"} = 1;
 
-    if ($className =~ /^V8SVGAnimated/) {
-        AddIncludesForSVGAnimatedType($interfaceName);
-    }
-
     AddIncludesForType($interfaceName);
 
     my $toActive = IsActiveDomType($interfaceName) ? "${className}::toActiveDOMObject" : "0";
@@ -1984,8 +2004,7 @@ END
 
     # Setup the enable-at-runtime attrs if we have them
     foreach my $runtime_attr (@enabledAtRuntime) {
-        # A function named RuntimeEnabledFeatures::{methodName}Enabled() need to be written by hand.
-        $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($runtime_attr->signature->name) . "Enabled";
+        my $enable_function = GetRuntimeEnableFunctionName($runtime_attr->signature);
         my $conditionalString = GenerateConditionalString($runtime_attr->signature);
         push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
         push(@implContent, "    if (${enable_function}()) {\n");
@@ -2034,7 +2053,7 @@ END
         my $conditional = "";
         if ($attrExt->{"EnabledAtRuntime"}) {
             # Only call Set()/SetAccessor() if this method should be enabled
-            $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($function->signature->name) . "Enabled";
+            $enable_function = GetRuntimeEnableFunctionName($function->signature);
             $conditional = "if (${enable_function}())\n        ";
         }
 
@@ -2131,10 +2150,7 @@ END
 END
     }
 
-    my $nativeType = GetNativeTypeForConversions($interfaceName);
-    if ($dataNode->extendedAttributes->{"PODType"}) {
-        $nativeType = "V8SVGPODTypeWrapper<${nativeType}>";
-    }
+    my $nativeType = GetNativeTypeForConversions($dataNode, $interfaceName);
     push(@implContent, <<END);
 
     // Custom toString template
@@ -2509,7 +2525,9 @@ sub HasCustomToV8Implementation {
     # We generate a custom converter (but JSC doesn't) for the following:
     return 1 if $interfaceName eq "CSSStyleSheet";
     return 1 if $interfaceName eq "CanvasPixelArray";
+    return 1 if $interfaceName eq "DOMStringMap";
     return 1 if $interfaceName eq "DOMWindow";
+    return 1 if $interfaceName eq "DOMTokenList";
     return 1 if $interfaceName eq "Element";
     return 1 if $interfaceName eq "HTMLDocument";
     return 1 if $interfaceName eq "HTMLElement";
@@ -2537,7 +2555,7 @@ sub GetDomMapFunction
     return "getDOMSVGElementInstanceMap()" if $type eq "SVGElementInstance";
     return "getDOMNodeMap()" if ($dataNode && IsNodeSubType($dataNode));
     # Only use getDOMSVGObjectWithContextMap() for non-node svg objects
-    return "getDOMSVGObjectWithContextMap()" if $type =~ /SVG/;
+    return "getDOMSVGObjectWithContextMap()" if $type =~ /SVG/ and not $codeGenerator->IsSVGTypeNeedingTearOff($type) and not $codeGenerator->IsSVGAnimatedType($type);
     return "" if $type eq "DOMImplementation";
     return "getActiveDOMObjectMap()" if IsActiveDomType($type);
     return "getDOMObjectMap()";
@@ -2554,16 +2572,18 @@ sub IsActiveDomType
     return 1 if $type eq "Worker";
     return 1 if $type eq "SharedWorker";
     return 1 if $type eq "IDBRequest";
+    return 1 if $type eq "FileReader";
+    return 1 if $type eq "FileWriter";
+    return 1 if $type eq "FileWriterSync";
     return 0;
 }
 
 sub GetNativeTypeForConversions
 {
+    my $dataNode = shift;
     my $type = shift;
-    return "FloatRect" if $type eq "SVGRect";
-    return "FloatPoint" if $type eq "SVGPoint";
-    return "AffineTransform" if $type eq "SVGMatrix";
-    return "float" if $type eq "SVGNumber";
+
+    $type = $codeGenerator->GetSVGTypeNeedingTearOff($type) if $codeGenerator->IsSVGTypeNeedingTearOff($type); 
     return $type;
 }
 
@@ -2575,18 +2595,12 @@ sub GenerateFunctionCallString()
     my $implClassName = shift;
 
     my $name = $function->signature->name;
-    my $isPodType = IsPodType($implClassName);
     my $returnType = GetTypeFromSignature($function->signature);
-    my $returnsPodType = IsPodType($returnType);
     my $nativeReturnType = GetNativeType($returnType, 0);
     my $result = "";
 
-    # Special case: SVG matrix transform methods should not mutate
-    # the matrix but return a copy
-    my $copyFirst = 0;
-    if ($implClassName eq "SVGMatrix" && $function->signature->type eq "SVGMatrix") {
-        $copyFirst = 1;
-    }
+    my $isSVGTearOffType = ($codeGenerator->IsSVGTypeNeedingTearOff($returnType) and not $implClassName =~ /List$/);
+    $nativeReturnType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($returnType) if $isSVGTearOffType;
 
     if ($function->signature->extendedAttributes->{"v8implname"}) {
         $name = $function->signature->extendedAttributes->{"v8implname"};
@@ -2597,23 +2611,10 @@ sub GenerateFunctionCallString()
     }
 
     my $functionString = "imp->${name}(";
-
-    if ($copyFirst) {
-        $functionString = "result.${name}(";
-    }
-
     if ($function->signature->extendedAttributes->{"ClassMethod"}) {
         $functionString = "${implClassName}::${name}(";
     }
 
-    my $returnsListItemPodType = 0;
-    # SVG lists functions that return POD types require special handling
-    if (IsSVGListTypeNeedingSpecialHandling($implClassName) && IsSVGListMethod($name) && $returnsPodType) {
-        $returnsListItemPodType = 1;
-        $result .= $indent . "SVGList<RefPtr<SVGPODListItem<$nativeReturnType> > >* listImp = imp;\n";
-        $functionString = "listImp->${name}(";
-    }
-
     my $index = 0;
     my $hasScriptState = 0;
 
@@ -2649,14 +2650,16 @@ sub GenerateFunctionCallString()
         my $paramName = $parameter->name;
         my $paramType = $parameter->type;
 
-        # This is a bit of a hack... we need to convert parameters to methods on SVG lists
-        # of POD types which are items in the list to appropriate SVGList<> instances
-        if ($returnsListItemPodType && $paramType . "List" eq $implClassName) {
-            $paramName = "SVGPODListItem<" . GetNativeType($paramType, 1) . ">::copy($paramName)";
-        }
-
         if ($parameter->type eq "NodeFilter" || $parameter->type eq "XPathNSResolver") {
             $functionString .= "$paramName.get()";
+        } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($parameter->type) and not $implClassName =~ /List$/) {
+            $functionString .= "$paramName->propertyReference()";
+            $result .= $indent . "if (!$paramName) {\n";
+            $result .= $indent . "    V8Proxy::setDOMException(WebCore::TYPE_MISMATCH_ERR);\n";
+            $result .= $indent . "    return v8::Handle<v8::Value>();\n";
+            $result .= $indent . "}\n";
+        } elsif ($parameter->type eq "SVGMatrix" and $implClassName eq "SVGTransformList") {
+            $functionString .= "$paramName.get()";
         } else {
             $functionString .= $paramName;
         }
@@ -2665,8 +2668,8 @@ sub GenerateFunctionCallString()
 
     if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
         $functionString .= ", " if $index;
-        $functionString .= "callStack.get()";
-        $index++;
+        $functionString .= "scriptArguments.release(), callStack.release()";
+        $index += 2;
     }
 
     if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) {
@@ -2689,16 +2692,16 @@ sub GenerateFunctionCallString()
 
     if ($returnType eq "void") {
         $result .= $indent . "$functionString;\n";
-    } elsif ($copyFirst) {
-        $result .= $indent . GetNativeType($returnType, 0) . " result = *imp;\n" . $indent . "$functionString;\n";
-    } elsif ($returnsListItemPodType) {
-        $result .= $indent . "RefPtr<SVGPODListItem<$nativeReturnType> > result = $functionString;\n";
-    } elsif ($hasScriptState or @{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) {
+    } elsif ($hasScriptState or @{$function->raisesExceptions}) {
         $result .= $indent . $nativeReturnType . " result = $functionString;\n";
     } else {
         # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary
         $return = $functionString;
         $returnIsRef = 0;
+    
+        if ($implClassName eq "SVGTransformList" and IsRefPtrType($returnType)) {
+            $return = "WTF::getPtr(" . $return . ")";
+        }
     }
 
     if (@{$function->raisesExceptions}) {
@@ -2711,15 +2714,12 @@ sub GenerateFunctionCallString()
         $result .= $indent . "    return throwError(state.exception());\n"
     }
 
-    # If the return type is a POD type, separate out the wrapper generation
-    if ($returnsListItemPodType) {
-        $result .= $indent . "RefPtr<V8SVGPODTypeWrapper<" . $nativeReturnType . "> > wrapper = ";
-        $result .= "V8SVGPODTypeWrapperCreatorForList<" . $nativeReturnType . ">::create($return, imp->associatedAttributeName());\n";
-        $return = "wrapper";
-    } elsif ($returnsPodType) {
-        $result .= $indent . "RefPtr<V8SVGPODTypeWrapper<" . $nativeReturnType . "> > wrapper = ";
-        $result .= GenerateSVGStaticPodTypeWrapper($returnType, $return) . ";\n";
-        $return = "wrapper";
+    if ($isSVGTearOffType) {
+        $implIncludes{"V8$returnType.h"} = 1;
+        $implIncludes{"SVGPropertyTearOff.h"} = 1;
+        my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($returnType);
+        $result .= $indent . "return toV8(WTF::getPtr(${svgNativeType}::create($return)));\n";
+        return $result;
     }
 
     my $generatedSVGContextRetrieval = 0;
@@ -2740,22 +2740,12 @@ sub GenerateFunctionCallString()
     }
 
     # If the implementing class is a POD type, commit changes
-    if ($isPodType) {
-        if (!$generatedSVGContextRetrieval) {
-            $result .= GenerateSVGContextRetrieval($implClassName, $indent);
-            $generatedSVGContextRetrieval = 1;
-        }
-
-        $result .= $indent . "impWrapper->commitChange(impInstance, context);\n";
+    if ($codeGenerator->IsSVGTypeNeedingTearOff($implClassName) and not $implClassName =~ /List$/) {
+        $result .= $indent . "wrapper->commitChange();\n";
     }
 
-    if ($returnsPodType) {
-        $implIncludes{"V8${returnType}.h"} = 1;
-        $result .= $indent . "return toV8(wrapper.release());\n";
-    } else {
-        $return .= ".release()" if ($returnIsRef);
-        $result .= $indent . ReturnNativeToJSValue($function->signature, $return, $indent) . ";\n";
-    }
+    $return .= ".release()" if ($returnIsRef);
+    $result .= $indent . ReturnNativeToJSValue($function->signature, $return, $indent) . ";\n";
 
     return $result;
 }
@@ -2811,7 +2801,6 @@ sub IsRefPtrType
     return 0 if $type eq "unsigned";
     return 0 if $type eq "unsigned long";
     return 0 if $type eq "unsigned short";
-    return 0 if $type eq "SVGAnimatedPoints";
 
     return 1;
 }
@@ -2821,6 +2810,15 @@ sub GetNativeType
     my $type = shift;
     my $isParameter = shift;
 
+    my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
+    if ($svgNativeType) {
+        if ($svgNativeType =~ /List$/) {
+            return "${svgNativeType}*";
+        } else {
+            return "RefPtr<${svgNativeType} >";
+        }
+    }
+
     if ($type eq "float" or $type eq "double") {
         return $type;
     }
@@ -2835,14 +2833,6 @@ sub GetNativeType
     return "bool" if $type eq "boolean";
     return "String" if $type eq "DOMString";
     return "Range::CompareHow" if $type eq "CompareHow";
-    return "FloatRect" if $type eq "SVGRect";
-    return "FloatPoint" if $type eq "SVGPoint";
-    return "AffineTransform" if $type eq "SVGMatrix";
-    return "SVGTransform" if $type eq "SVGTransform";
-    return "SVGLength" if $type eq "SVGLength";
-    return "SVGAngle" if $type eq "SVGAngle";
-    return "float" if $type eq "SVGNumber";
-    return "SVGPreserveAspectRatio" if $type eq "SVGPreserveAspectRatio";
     return "SVGPaint::SVGPaintType" if $type eq "SVGPaintType";
     return "DOMTimeStamp" if $type eq "DOMTimeStamp";
     return "unsigned" if $type eq "unsigned int";
@@ -2887,21 +2877,6 @@ sub TranslateParameter
     }
 }
 
-sub BasicTypeCanFailConversion
-{
-    my $signature = shift;
-    my $type = GetTypeFromSignature($signature);
-
-    return 1 if $type eq "SVGAngle";
-    return 1 if $type eq "SVGLength";
-    return 1 if $type eq "SVGMatrix";
-    return 1 if $type eq "SVGPoint";
-    return 1 if $type eq "SVGPreserveAspectRatio";
-    return 1 if $type eq "SVGRect";
-    return 1 if $type eq "SVGTransform";
-    return 0;
-}
-
 sub TypeCanFailConversion
 {
     my $signature = shift;
@@ -2911,25 +2886,23 @@ sub TypeCanFailConversion
     $implIncludes{"ExceptionCode.h"} = 1 if $type eq "Attr";
     return 1 if $type eq "Attr";
     return 1 if $type eq "VoidCallback";
-    return BasicTypeCanFailConversion($signature);
+    return 1 if $type eq "IDBKey";
+    return 0;
 }
 
 sub JSValueToNative
 {
     my $signature = shift;
     my $value = shift;
-    my $okParam = shift;
-    my $maybeOkParam = $okParam ? ", ${okParam}" : "";
 
     my $type = GetTypeFromSignature($signature);
 
     return "$value" if $type eq "JSObject";
     return "$value->BooleanValue()" if $type eq "boolean";
     return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $type eq "double";
-    return "$value->NumberValue()" if $type eq "SVGNumber";
 
-    return "toInt32($value${maybeOkParam})" if $type eq "long";
-    return "toUInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short";
+    return "toInt32($value)" if $type eq "long";
+    return "toUInt32($value)" if $type eq "unsigned long" or $type eq "unsigned short";
     return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long";
     return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow";
     return "static_cast<SVGPaint::SVGPaintType>($value->ToInt32()->Int32Value())" if $type eq "SVGPaintType";
@@ -2960,10 +2933,6 @@ sub JSValueToNative
         $implIncludes{"FloatRect.h"} = 1;
     }
 
-    if ($type eq "SVGPoint") {
-        $implIncludes{"FloatPoint.h"} = 1;
-    }
-
     # Default, assume autogenerated type conversion routines
     if ($type eq "EventTarget") {
         $implIncludes{"V8Node.h"} = 1;
@@ -2987,15 +2956,6 @@ sub JSValueToNative
     } else {
         $implIncludes{"V8$type.h"} = 1;
 
-        if (IsPodType($type)) {
-            my $nativeType = GetNativeType($type);
-            $implIncludes{"V8SVGPODTypeWrapper.h"} = 1;
-
-            return "V8SVGPODTypeUtil::toSVGPODType<${nativeType}>(&V8${type}::info, $value${maybeOkParam})"
-        }
-
-        $implIncludes{"V8${type}.h"} = 1;
-
         # Perform type checks on the parameter, if it is expected Node type,
         # return NULL.
         return "V8${type}::HasInstance($value) ? V8${type}::toNative(v8::Handle<v8::Object>::Cast($value)) : 0";
@@ -3092,14 +3052,6 @@ my %non_wrapper_types = (
     'DOMString' => 1,
     'CompareHow' => 1,
     'SerializedScriptValue' => 1,
-    'SVGAngle' => 1,
-    'SVGRect' => 1,
-    'SVGPoint' => 1,
-    'SVGPreserveAspectRatio' => 1,
-    'SVGMatrix' => 1,
-    'SVGTransform' => 1,
-    'SVGLength' => 1,
-    'SVGNumber' => 1,
     'SVGPaintType' => 1,
     'DOMTimeStamp' => 1,
     'JSObject' => 1,
@@ -3210,24 +3162,9 @@ sub ReturnNativeToJSValue
     $implIncludes{"wtf/RefPtr.h"} = 1;
     $implIncludes{"wtf/GetPtr.h"} = 1;
 
-    if (IsPodType($type)) {
-        $value = GenerateSVGStaticPodTypeWrapper($type, $value) . ".get()";
-    }
-
     return "return toV8($value)";
 }
 
-sub GenerateSVGStaticPodTypeWrapper {
-    my $type = shift;
-    my $value = shift;
-
-    $implIncludes{"V8$type.h"}=1;
-    $implIncludes{"V8SVGPODTypeWrapper.h"} = 1;
-
-    my $nativeType = GetNativeType($type);
-    return "V8SVGStaticPODTypeWrapper<$nativeType>::create($value)";
-}
-
 # Internal helper
 sub WriteData
 {
@@ -3271,17 +3208,24 @@ sub WriteData
     }
 }
 
+# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
 sub IsSVGTypeNeedingContextParameter
 {
     my $implClassName = shift;
 
-    if ($implClassName =~ /SVG/ and not $implClassName =~ /Element/) {
-        return 1 unless $implClassName =~ /SVGPaint/ or $implClassName =~ /SVGColor/ or $implClassName =~ /SVGDocument/;
-    }
+    return 0 unless $implClassName =~ /SVG/;
+    return 0 if $implClassName =~ /Element/;
+    return 0 if $codeGenerator->IsSVGAnimatedType($implClassName);
+    return 0 if $codeGenerator->IsSVGTypeNeedingTearOff($implClassName);
 
-    return 0;
+    my @noContextNeeded = ("SVGColor", "SVGDocument", "SVGPaintType", "SVGPaint", "SVGZoomEvent");
+    foreach (@noContextNeeded) {
+        return 0 if $implClassName eq $_;
+    }
+    return 1;
 }
 
+# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
 sub GenerateSVGContextAssignment
 {
     my $srcType = shift;
@@ -3294,24 +3238,15 @@ sub GenerateSVGContextAssignment
     return $result;
 }
 
+# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
 sub GenerateSVGContextRetrieval
 {
     my $srcType = shift;
     my $indent = shift;
 
-    my $srcIsPodType = IsPodType($srcType);
-
-    my $srcObject = "imp";
-    if ($srcIsPodType) {
-        $srcObject = "impWrapper";
-    }
-
-    my $contextDecl;
-
+    my $contextDecl = "imp";
     if (IsSVGTypeNeedingContextParameter($srcType)) {
-        $contextDecl = "V8Proxy::svgContext($srcObject)";
-    } else {
-        $contextDecl = $srcObject;
+        $contextDecl = "V8Proxy::svgContext($contextDecl)";
     }
 
     return $indent . "SVGElement* context = $contextDecl;\n";
@@ -3331,27 +3266,6 @@ sub IsSVGListMutator
     return 0;
 }
 
-sub IsSVGListMethod
-{
-    my $functionName = shift;
-
-    return 1 if $functionName eq "getFirst";
-    return 1 if $functionName eq "getLast";
-    return 1 if $functionName eq "getItem";
-
-    return IsSVGListMutator($functionName);
-}
-
-sub IsSVGListTypeNeedingSpecialHandling
-{
-    my $className = shift;
-
-    return 1 if $className eq "SVGPointList";
-    return 1 if $className eq "SVGTransformList";
-
-    return 0;
-}
-
 sub GetVisibleInterfaceName
 {
     my $interfaceName = shift;
@@ -3389,6 +3303,18 @@ sub ConvertToV8Parameter
     }
 }
 
+# Returns the RuntimeEnabledFeatures function name that is hooked up to check if a method/attribute is enabled.
+sub GetRuntimeEnableFunctionName
+{
+    my $signature = shift;
+
+    # If a parameter is given (e.g. "EnabledAtRuntime=FeatureName") return the RuntimeEnabledFeatures::{FeatureName}Enabled() method.
+    return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->extendedAttributes->{"EnabledAtRuntime"}) . "Enabled" if ($signature->extendedAttributes->{"EnabledAtRuntime"} && $signature->extendedAttributes->{"EnabledAtRuntime"} ne "1");
+
+    # Otherwise return a function named RuntimeEnabledFeatures::{methodName}Enabled().
+    return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->name) . "Enabled";
+}
+
 sub DebugPrint
 {
     my $output = shift;