Changeset 70631 in webkit


Ignore:
Timestamp:
Oct 27, 2010 3:26:56 AM (13 years ago)
Author:
Nikolas Zimmermann
Message:

2010-10-26 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Rob Buis.

Convert SVGRect to the new SVGPropertyTearOff concept
https://bugs.webkit.org/show_bug.cgi?id=48204

Convert the next SVG primitive type to use the SVGPropertyTearOff concept: SVGRect.
Added new test verifying that StrictTypeChecking is enabled for SVGRect. Refactor and share code between JSC/V8/ObjC generators.

Test: svg/dom/SVGRect.html

  • GNUmakefile.am: Add SVGAnimatedRect.h to build.
  • WebCore.gypi: Ditto.
  • WebCore.pro: Ditto.
  • WebCore.vcproj/WebCore.vcproj: Ditto.
  • WebCore.xcodeproj/project.pbxproj: Ditto.
  • bindings/scripts/CodeGenerator.pm: Refactor SVGPropertyTearOff handling, and share code between JSC/V8/ObjC generators.
  • bindings/scripts/CodeGeneratorJS.pm: Ditto.
  • bindings/scripts/CodeGeneratorObjC.pm: Ditto.
  • bindings/scripts/CodeGeneratorV8.pm: Ditto.
  • svg/DeprecatedSVGAnimatedPropertyTraits.h: Remove SVGAnimatedRect handling.
  • svg/DeprecatedSVGAnimatedTemplate.h: Ditto.
  • svg/SVGAngle.idl: Remove [SVGProperty] flag.
  • svg/SVGAnimatedAngle.idl: Remove [SVGAnimatedProperty] flag.
  • svg/SVGAnimatedLength.idl: Ditto.
  • svg/SVGAnimatedLengthList.idl: Ditto.
  • svg/SVGAnimatedRect.h: Added.
  • svg/SVGFitToViewBox.h: SVGRect now uses the new tear off concept, adapt code.
  • svg/SVGLength.idl: Remove [SVGProperty] flag.
  • svg/SVGMarkerElement.h:
  • svg/SVGPatternElement.h:
  • svg/SVGRect.idl: Remove [PODType] flag, add StrictTypeChecking to all attributes.
  • svg/SVGSVGElement.cpp: s/setViewBox/setViewBoxBaseValue/. (WebCore::SVGSVGElement::currentView): (WebCore::SVGSVGElement::inheritViewAttributes):
  • svg/SVGSVGElement.h:
  • svg/SVGSVGElement.idl: Remove [Immutable] flags for SVGRect types, no longer needed.
  • svg/SVGSymbolElement.h:
  • svg/SVGViewElement.h:
  • svg/SVGViewSpec.cpp: Take a SVGElement as context element. (WebCore::SVGViewSpec::SVGViewSpec):
  • svg/SVGViewSpec.h: Ditto. (WebCore::SVGViewSpec::contextElement):
  • svg/SVGZoomEvent.idl: Remove [Immutable] flags for SVGRect types, no longer needed.
  • svg/properties/SVGAnimatedPropertyMacros.h: Support declaring animated properties on non-SVGElement types (here: SVGViewSpec), just like the old macros handled it.

2010-10-26 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Rob Buis.

Convert SVGRect to the new SVGPropertyTearOff concept
https://bugs.webkit.org/show_bug.cgi?id=48204

Added new test verifying that StrictTypeChecking is enabled for SVGRect.

  • svg/dom/SVGRect-expected.txt: Added.
  • svg/dom/SVGRect.html: Added.
  • svg/dom/script-tests/SVGRect.js: Added.
Location:
trunk
Files:
4 added
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r70630 r70631  
     12010-10-26  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Rob Buis.
     4
     5        Convert SVGRect to the new SVGPropertyTearOff concept
     6        https://bugs.webkit.org/show_bug.cgi?id=48204
     7
     8        Added new test verifying that StrictTypeChecking is enabled for SVGRect.
     9
     10        * svg/dom/SVGRect-expected.txt: Added.
     11        * svg/dom/SVGRect.html: Added.
     12        * svg/dom/script-tests/SVGRect.js: Added.
     13
    1142010-10-27  Adam Roben  <aroben@apple.com>
    215
  • trunk/WebCore/ChangeLog

    r70624 r70631  
     12010-10-26  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Rob Buis.
     4
     5        Convert SVGRect to the new SVGPropertyTearOff concept
     6        https://bugs.webkit.org/show_bug.cgi?id=48204
     7
     8        Convert the next SVG primitive type to use the SVGPropertyTearOff concept: SVGRect.
     9        Added new test verifying that StrictTypeChecking is enabled for SVGRect. Refactor and share code between JSC/V8/ObjC generators.
     10
     11        Test: svg/dom/SVGRect.html
     12
     13        * GNUmakefile.am: Add SVGAnimatedRect.h to build.
     14        * WebCore.gypi: Ditto.
     15        * WebCore.pro: Ditto.
     16        * WebCore.vcproj/WebCore.vcproj: Ditto.
     17        * WebCore.xcodeproj/project.pbxproj: Ditto.
     18        * bindings/scripts/CodeGenerator.pm: Refactor SVGPropertyTearOff handling, and share code between JSC/V8/ObjC generators.
     19        * bindings/scripts/CodeGeneratorJS.pm: Ditto.
     20        * bindings/scripts/CodeGeneratorObjC.pm: Ditto.
     21        * bindings/scripts/CodeGeneratorV8.pm: Ditto.
     22        * svg/DeprecatedSVGAnimatedPropertyTraits.h: Remove SVGAnimatedRect handling.
     23        * svg/DeprecatedSVGAnimatedTemplate.h: Ditto.
     24        * svg/SVGAngle.idl: Remove [SVGProperty] flag.
     25        * svg/SVGAnimatedAngle.idl: Remove [SVGAnimatedProperty] flag.
     26        * svg/SVGAnimatedLength.idl: Ditto.
     27        * svg/SVGAnimatedLengthList.idl: Ditto.
     28        * svg/SVGAnimatedRect.h: Added.
     29        * svg/SVGFitToViewBox.h: SVGRect now uses the new tear off concept, adapt code.
     30        * svg/SVGLength.idl: Remove [SVGProperty] flag.
     31        * svg/SVGMarkerElement.h:
     32        * svg/SVGPatternElement.h:
     33        * svg/SVGRect.idl: Remove [PODType] flag, add StrictTypeChecking to all attributes.
     34        * svg/SVGSVGElement.cpp: s/setViewBox/setViewBoxBaseValue/.
     35        (WebCore::SVGSVGElement::currentView):
     36        (WebCore::SVGSVGElement::inheritViewAttributes):
     37        * svg/SVGSVGElement.h:
     38        * svg/SVGSVGElement.idl: Remove [Immutable] flags for SVGRect types, no longer needed.
     39        * svg/SVGSymbolElement.h:
     40        * svg/SVGViewElement.h:
     41        * svg/SVGViewSpec.cpp: Take a SVGElement as context element.
     42        (WebCore::SVGViewSpec::SVGViewSpec):
     43        * svg/SVGViewSpec.h: Ditto.
     44        (WebCore::SVGViewSpec::contextElement):
     45        * svg/SVGZoomEvent.idl: Remove [Immutable] flags for SVGRect types, no longer needed.
     46        * svg/properties/SVGAnimatedPropertyMacros.h: Support declaring animated properties on non-SVGElement types (here: SVGViewSpec), just like the old macros handled it.
     47
    1482010-10-27  Pavel Podivilov  <podivilov@chromium.org>
    249
  • trunk/WebCore/GNUmakefile.am

    r70581 r70631  
    30423042        WebCore/svg/SVGAnimatedPoints.cpp \
    30433043        WebCore/svg/SVGAnimatedPoints.h \
     3044        WebCore/svg/SVGAnimatedRect.h \
    30443045        WebCore/svg/SVGAnimateElement.cpp \
    30453046        WebCore/svg/SVGAnimateElement.h \
  • trunk/WebCore/WebCore.gypi

    r70581 r70631  
    39743974            'svg/SVGAnimatedPoints.cpp',
    39753975            'svg/SVGAnimatedPoints.h',
     3976            'svg/SVGAnimatedRect.h',
    39763977            'svg/SVGAnimationElement.cpp',
    39773978            'svg/SVGAnimationElement.h',
  • trunk/WebCore/WebCore.pro

    r70581 r70631  
    23662366    svg/SVGAnimatedPathData.h \
    23672367    svg/SVGAnimatedPoints.h \
     2368    svg/SVGAnimatedRect.h \
    23682369    svg/SVGAnimateElement.h \
    23692370    svg/SVGAnimateMotionElement.h \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r70597 r70631  
    6149761497                        </File>
    6149861498                        <File
     61499                                RelativePath="..\svg\SVGAnimatedRect.h"
     61500                                >
     61501                        </File>
     61502                        <File
    6149961503                                RelativePath="..\svg\SVGAnimateElement.h"
    6150061504                                >
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r70581 r70631  
    226226                08C6A7AC117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C6A7AA117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.h */; };
    227227                08C7A2C710DC7462002D368B /* SVGNames.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 656581E909D1508D000E61D7 /* SVGNames.h */; };
     228                08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C859BF1274575300A5728D /* SVGAnimatedRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
    228229                08C925190FCC7C4A00480DEC /* FilterEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C925170FCC7C4A00480DEC /* FilterEffect.cpp */; };
    229230                08C9251A0FCC7C4A00480DEC /* FilterEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C925180FCC7C4A00480DEC /* FilterEffect.h */; };
     
    62196220                08C6A7A9117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceSolidColor.cpp; sourceTree = "<group>"; };
    62206221                08C6A7AA117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceSolidColor.h; sourceTree = "<group>"; };
     6222                08C859BF1274575300A5728D /* SVGAnimatedRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedRect.h; sourceTree = "<group>"; };
    62216223                08C925170FCC7C4A00480DEC /* FilterEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FilterEffect.cpp; path = filters/FilterEffect.cpp; sourceTree = "<group>"; };
    62226224                08C925180FCC7C4A00480DEC /* FilterEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FilterEffect.h; path = filters/FilterEffect.h; sourceTree = "<group>"; };
     
    1598015982                                B22277F30D00BF1F0071B782 /* SVGAnimatedPoints.idl */,
    1598115983                                B22277F40D00BF1F0071B782 /* SVGAnimatedPreserveAspectRatio.idl */,
     15984                                08C859BF1274575300A5728D /* SVGAnimatedRect.h */,
    1598215985                                B22277F50D00BF1F0071B782 /* SVGAnimatedRect.idl */,
    1598315986                                B22277F60D00BF1F0071B782 /* SVGAnimatedString.idl */,
     
    2117621179                                8AB4BC77126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h in Headers */,
    2117721180                                087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */,
     21181                                08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */,
    2117821182                                758978ED127090D60076D5A9 /* SpeechInputResult.h in Headers */,
    2117921183                        );
     
    2123621240                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
    2123721241                        compatibilityVersion = "Xcode 2.4";
    21238                         developmentRegion = English;
    2123921242                        hasScannedForEncodings = 1;
    2124021243                        knownRegions = (
  • trunk/WebCore/bindings/scripts/CodeGenerator.pm

    r70581 r70631  
    5252
    5353my %podTypeHash = ("SVGNumber" => 1, "SVGTransform" => 1);
    54 my %podTypesWithWritablePropertiesHash = ("SVGMatrix" => 1, "SVGPoint" => 1, "SVGPreserveAspectRatio" => 1, "SVGRect" => 1);
     54my %podTypesWithWritablePropertiesHash = ("SVGMatrix" => 1, "SVGPoint" => 1, "SVGPreserveAspectRatio" => 1);
    5555my %stringTypeHash = ("DOMString" => 1, "AtomicString" => 1);
    5656
    5757my %nonPointerTypeHash = ("DOMTimeStamp" => 1, "CompareHow" => 1, "SVGPaintType" => 1);
    5858
    59 my %svgTypeNeedingTearOffHash = ("SVGLength" => 1, "SVGAngle" => 1);
    60 
    61 my %svgNewStyleAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1);
     59my %svgNewStyleAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1, "SVGAnimatedRect" => 1);
    6260
    6361my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1,
     
    7472                               "onmouseup" => 1, "onresize" => 1, "onscroll" => 1,
    7573                               "onunload" => 1);
     74
     75my %svgNativeType = (
     76    "SVGAngle" => "SVGPropertyTearOff<SVGAngle>",
     77    "SVGLength" => "SVGPropertyTearOff<SVGLength>",
     78    "SVGLengthList" => "SVGListPropertyTearOff<SVGLengthList>",
     79    "SVGRect" => "SVGPropertyTearOff<FloatRect>"
     80);
    7681
    7782# Cache of IDL file pathnames.
     
    288293# Helpers for all CodeGenerator***.pm modules
    289294
     295sub AvoidInclusionOfType
     296{
     297    my $object = shift;
     298    my $type = shift;
     299
     300    # Special case: SVGRect.h / SVGPoint.h / SVGNumber.h / SVGMatrix.h do not exist.
     301    return 1 if $type eq "SVGRect" or $type eq "SVGPoint" or $type eq "SVGNumber" or $type eq "SVGMatrix";
     302    return 0;
     303}
     304
    290305# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
    291306sub IsPodType
     
    345360}
    346361
    347 
    348362sub IsSVGTypeNeedingTearOff
    349363{
     
    351365    my $type = shift;
    352366
    353     return 1 if $svgTypeNeedingTearOffHash{$type};
    354     return 0;
     367    return 1 if exists $svgNativeType{$type};
     368    return 0;
     369}
     370
     371sub GetSVGTypeNeedingTearOff
     372{
     373    my $object = shift;
     374    my $type = shift;
     375
     376    return $svgNativeType{$type} if exists $svgNativeType{$type};
     377    return undef;
     378}
     379
     380sub GetSVGWrappedTypeNeedingTearOff
     381{
     382    my $object = shift;
     383    my $type = shift;
     384
     385    my $svgNativeType = $object->GetSVGTypeNeedingTearOff($type);
     386    return $svgNativeType if not $svgNativeType;
     387
     388    if ($svgNativeType =~ /SVGPropertyTearOff/) {
     389        $svgNativeType =~ s/SVGPropertyTearOff<//;
     390    } elsif ($svgNativeType =~ /SVGListPropertyTearOff/) {
     391        $svgNativeType =~ s/SVGListPropertyTearOff<//;
     392    }
     393    $svgNativeType =~ s/>//;
     394    return $svgNativeType;
    355395}
    356396
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r70581 r70631  
    228228}
    229229
    230 sub AvoidInclusionOfType
    231 {
    232     my $type = shift;
    233 
    234     # Special case: SVGRect.h / SVGPoint.h / SVGNumber.h / SVGMatrix.h do not exist.
    235     return 1 if $type eq "SVGRect" or $type eq "SVGPoint" or $type eq "SVGNumber" or $type eq "SVGMatrix";
    236     return 0;
    237 }
    238 
    239230sub IndexGetterReturnsStrings
    240231{
     
    252243    # When we're finished with the one-file-per-class
    253244    # reorganization, we won't need these special cases.
    254     if ($codeGenerator->IsPrimitiveType($type) or AvoidInclusionOfType($type)
     245    if ($codeGenerator->IsPrimitiveType($type) or $codeGenerator->AvoidInclusionOfType($type)
    255246        or $type eq "DOMString" or $type eq "DOMObject" or $type eq "Array") {
    256247    } elsif ($type =~ /SVGPathSeg/) {
     
    285276}
    286277
     278# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
    287279sub AddIncludesForSVGAnimatedType
    288280{
     
    335327    return 0 if $implClassName =~ /Element/;
    336328    return 0 if $codeGenerator->IsSVGNewStyleAnimatedType($implClassName);
    337 
    338     my @noContextNeeded = ("SVGAngle", "SVGLength", "SVGLengthList", "SVGPaint", "SVGColor", "SVGDocument", "SVGZoomEvent");
     329    return 0 if $codeGenerator->IsSVGTypeNeedingTearOff($implClassName);
     330
     331    my @noContextNeeded = ("SVGColor", "SVGDocument", "SVGPaint", "SVGZoomEvent");
    339332    foreach (@noContextNeeded) {
    340333        return 0 if $implClassName eq $_;
     
    674667   
    675668    $headerIncludes{"<runtime/JSObjectWithGlobalObject.h>"} = 1;
    676 
    677669    $headerIncludes{"SVGElement.h"} = 1 if $className =~ /^JSSVG/;
    678670
    679     # Get correct pass/store types respecting PODType flag
    680671    my $implType = $implClassName;
    681 
    682     my $svgPropertyType = $dataNode->extendedAttributes->{"SVGProperty"};   
    683     if ($svgPropertyType) {
    684         $implType = "SVGPropertyTearOff<$svgPropertyType> ";
    685         $headerIncludes{"SVGAnimatedProperty.h"} = 1;
    686         $headerIncludes{"SVGPropertyTearOff.h"} = 1;
    687         $headerIncludes{"$svgPropertyType.h"} = 1 if $svgPropertyType ne "float";
    688     }
    689 
    690     my $svgListPropertyType = $dataNode->extendedAttributes->{"SVGListProperty"};   
    691     if ($svgListPropertyType) {
    692         $implType = "SVGListPropertyTearOff<$svgListPropertyType> ";
    693         $headerIncludes{"SVGAnimatedProperty.h"} = 1;
    694         $headerIncludes{"SVGListPropertyTearOff.h"} = 1;
    695         $headerIncludes{"$svgListPropertyType.h"} = 1;
    696     }
     672    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implType);
     673    $implType = $svgNativeType if $svgNativeType;
    697674
    698675    # FIXME: Old style SVG JS bindings, will vanish soon.
     
    715692    push(@headerContent, "\nnamespace WebCore {\n\n");
    716693
    717     my $svgAnimatedPropertyType = $dataNode->extendedAttributes->{"SVGAnimatedProperty"};   
    718     $headerIncludes{"$implClassName.h"} = 1 if $svgAnimatedPropertyType;
    719 
    720     # Implementation class forward declaration
    721     AddClassForwardIfNeeded($implClassName) unless $svgPropertyOrPodType or $svgAnimatedPropertyType;
     694    if ($codeGenerator->IsSVGNewStyleAnimatedType($implClassName)) {
     695        $headerIncludes{"$implClassName.h"} = 1;
     696    } else {
     697        # Implementation class forward declaration
     698        AddClassForwardIfNeeded($implClassName) unless $svgPropertyOrPodType;
     699    }
     700
    722701    AddClassForwardIfNeeded("JSDOMWindowShell") if $interfaceName eq "DOMWindow";
    723702
     
    14481427    push(@implContent, "};\n\n");
    14491428
    1450     # Get correct pass/store types respecting PODType flag
    14511429    my $implType = $implClassName;
    1452     my $svgPropertyType = $dataNode->extendedAttributes->{"SVGProperty"};   
    1453     my $svgListPropertyType = $dataNode->extendedAttributes->{"SVGListProperty"};   
     1430    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implType);
     1431    $implType = $svgNativeType if $svgNativeType;
     1432
    14541433    my $podType = $dataNode->extendedAttributes->{"PODType"};
    1455     if ($svgPropertyType) {
    1456         $implType = "SVGPropertyTearOff<$svgPropertyType> ";
    1457     } elsif ($svgListPropertyType) {
    1458         $implType = "SVGListPropertyTearOff<$svgListPropertyType> ";
    1459     } elsif ($podType) {
     1434    if ($podType) {
    14601435        $implType = "JSSVGPODTypeWrapper<$podType> ";
    14611436    }
     
    18111786                            # a TypeError is thrown instead of casting to null.
    18121787                            if ($attribute->signature->extendedAttributes->{"StrictTypeChecking"}) {
     1788                                $implIncludes{"<runtime/Error.h>"} = 1;
     1789
    18131790                                my $argType = $attribute->signature->type;
    18141791                                if (!IsNativeType($argType)) {
     
    20782055                            # a TypeError is thrown instead of casting to null.
    20792056                            if ($function->signature->extendedAttributes->{"StrictTypeChecking"}) {
     2057                                $implIncludes{"<runtime/Error.h>"} = 1;
     2058
    20802059                                my $argValue = "exec->argument($argsIndex)";
    20812060                                if (!IsNativeType($argType)) {
     
    24712450    "SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
    24722451    "IDBKey" => "RefPtr<IDBKey>",
    2473     "SVGAngle" => "SVGPropertyTearOff<SVGAngle>*",
    2474     "SVGLength" => "SVGPropertyTearOff<SVGLength>*",
    24752452    "SVGMatrix" => "AffineTransform",
    24762453    "SVGNumber" => "float",
     
    24942471    my $type = shift;
    24952472
     2473    my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
     2474    return "${svgNativeType}*" if $svgNativeType;
    24962475    return $nativeType{$type} if exists $nativeType{$type};
    24972476
    24982477    # For all other types, the native type is a pointer with same type name as the IDL type.
    24992478    return "${type}*";
     2479}
     2480
     2481sub GetSVGPropertyTypes
     2482{
     2483    my $implType = shift;
     2484
     2485    my $svgPropertyType;
     2486    my $svgListPropertyType;
     2487    my $svgNativeType;
     2488
     2489    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $implType =~ /SVG/;
     2490   
     2491    $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implType);
     2492    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $svgNativeType;
     2493
     2494    # Append space to avoid compilation errors when using  PassRefPtr<$svgNativeType>
     2495    $svgNativeType = "$svgNativeType ";
     2496
     2497    my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implType);
     2498    if ($svgNativeType =~ /SVGPropertyTearOff/) {
     2499        $svgPropertyType = $svgWrappedNativeType;
     2500        $headerIncludes{"$svgWrappedNativeType.h"} = 1;
     2501        $headerIncludes{"SVGPropertyTearOff.h"} = 1;
     2502    } elsif ($svgNativeType =~ /SVGListPropertyTearOff/) {
     2503        $svgListPropertyType = $svgWrappedNativeType;
     2504        $headerIncludes{"$svgWrappedNativeType.h"} = 1;
     2505        $headerIncludes{"SVGListPropertyTearOff.h"} = 1;
     2506    }
     2507
     2508    return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
    25002509}
    25012510
     
    26502659        # Default, include header with same name.
    26512660        $implIncludes{"JS$type.h"} = 1;
    2652         $implIncludes{"$type.h"} = 1;
     2661        $implIncludes{"$type.h"} = 1 if not $codeGenerator->AvoidInclusionOfType($type);
    26532662    }
    26542663
     
    26662675    if ($codeGenerator->IsSVGNewStyleAnimatedType($implClassName)) {
    26672676        # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked.
    2668         if ($implClassName =~ /List$/) {
    2669             $value = "static_cast<SVGListPropertyTearOff<$type>*>($value)";
    2670         } else {
    2671             $value = "static_cast<SVGPropertyTearOff<$type>*>($value)";
    2672         }
     2677        $value = "static_cast<" . GetNativeType($type) . ">($value)";
    26732678    } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $implClassName =~ /List$/) {
    2674         $value = "SVGPropertyTearOff<$type>::create($value)";
     2679        $value = $codeGenerator->GetSVGTypeNeedingTearOff($type) . "::create($value)";
    26752680    }
    26762681
  • trunk/WebCore/bindings/scripts/CodeGeneratorObjC.pm

    r70581 r70631  
    601601    }
    602602
    603     if ($type eq "SVGRect") {
    604         $implIncludes{"FloatRect.h"} = 1;
    605         $implIncludes{"DOMSVGRectInternal.h"} = 1;
    606         return;
    607     }
    608 
    609603    if ($type eq "SVGPoint") {
    610604        $implIncludes{"FloatPoint.h"} = 1;
     
    659653
    660654    # Default, include the same named file (the implementation) and the same name prefixed with "DOM".
    661     $implIncludes{"$type.h"} = 1;
     655    $implIncludes{"$type.h"} = 1 if not $codeGenerator->AvoidInclusionOfType($type);
    662656    $implIncludes{"DOM${type}Internal.h"} = 1;
     657}
     658
     659sub GetSVGPropertyTypes
     660{
     661    my $implType = shift;
     662
     663    my $svgPropertyType;
     664    my $svgListPropertyType;
     665    my $svgNativeType;
     666
     667    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $implType =~ /SVG/;
     668
     669    $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implType);
     670    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $svgNativeType;
     671
     672    # Append space to avoid compilation errors when using  PassRefPtr<$svgNativeType>
     673    $svgNativeType = "WebCore::$svgNativeType ";
     674    $svgNativeType =~ s/</\<WebCore::/;
     675
     676    my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implType);
     677    if ($svgNativeType =~ /SVGPropertyTearOff/) {
     678        $svgPropertyType = "WebCore::$svgWrappedNativeType";
     679        $svgPropertyType =~ s/</\<WebCore::/;
     680    } elsif ($svgNativeType =~ /SVGListPropertyTearOff/) {
     681        $svgListPropertyType = "WebCore::$svgWrappedNativeType";
     682        $svgListPropertyType =~ s/</\<WebCore::/;
     683    }
     684
     685    return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
    663686}
    664687
     
    975998        # Generate internal interfaces
    976999        my $podType = $dataNode->extendedAttributes->{"PODType"};
    977         my $svgPropertyType = $dataNode->extendedAttributes->{"SVGProperty"};
    978         my $svgListPropertyType = $dataNode->extendedAttributes->{"SVGListProperty"};
    9791000        my $podTypeWithNamespace;
    980         my $svgPropertyTypeWithNamespace;
    981         my $svgListPropertyTypeWithNamespace;
    9821001        my $implClassName = GetImplClassName($interfaceName);
    9831002        my $implClassNameWithNamespace = "WebCore::" . $implClassName;
    9841003
    9851004        my $implType = $implClassNameWithNamespace;
     1005        my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implClassName);
     1006        $implType = $svgNativeType if $svgNativeType;
     1007
    9861008        if ($podType) {
    9871009            $podTypeWithNamespace = ($podType eq "float") ? "$podType" : "WebCore::$podType";
    988         } elsif ($svgPropertyType) {
    989             $implType = "WebCore::SVGPropertyTearOff<$implType>";
    990             $svgPropertyTypeWithNamespace = ($svgPropertyType eq "float") ? "$svgPropertyType" : "WebCore::$svgPropertyType";
    991         } elsif ($svgListPropertyType) {
    992             $implType = "WebCore::SVGListPropertyTearOff<$implType>";
    993             $svgListPropertyTypeWithNamespace = "WebCore::$svgListPropertyType";
    9941010        }
    9951011 
     
    10181034            if ($podType and $podType ne "float") {
    10191035                push(@internalHeaderContent, "    class $podType;\n");
    1020             } elsif ($svgPropertyType and $svgPropertyType ne "float") {
    1021                 push(@internalHeaderContent, "    class $svgPropertyType;\n");
    1022             } elsif ($svgListPropertyType) {
    1023                 push(@internalHeaderContent, "    class $svgListPropertyType;\n");
    10241036            } elsif ($interfaceName eq "Node") {
    10251037                push(@internalHeaderContent, "    class EventTarget;\n    class Node;\n");
     
    10731085
    10741086    my $podType = $dataNode->extendedAttributes->{"PODType"};
    1075     my $svgPropertyType = $dataNode->extendedAttributes->{"SVGProperty"};
    1076     my $svgListPropertyType = $dataNode->extendedAttributes->{"SVGListProperty"};
    10771087    my $podTypeWithNamespace;
    1078     my $svgPropertyTypeWithNamespace;
    1079     my $svgListPropertyTypeWithNamespace;
    10801088    my $implType = $implClassNameWithNamespace;
     1089
     1090    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implClassName);
     1091    $implType = $svgNativeType if $svgNativeType;
    10811092
    10821093    if ($podType) {
    10831094        $podTypeWithNamespace = ($podType eq "float") ? "$podType" : "WebCore::$podType";
    1084     } elsif ($svgPropertyType) {
    1085         $implType = "WebCore::SVGPropertyTearOff<$implType>";
    1086         $svgPropertyTypeWithNamespace = ($svgPropertyType eq "float") ? "$svgPropertyType" : "WebCore::$svgPropertyType";
    1087     } elsif ($svgListPropertyType) {
    1088         $implType = "WebCore::SVGListPropertyTearOff<$implType>";
    1089         $svgListPropertyTypeWithNamespace = "WebCore::$svgListPropertyType";
    10901095    }
    10911096
     
    11241129    } else {
    11251130        if (!$podType) {
    1126             $implIncludes{"$implClassName.h"} = 1;
     1131            $implIncludes{"$implClassName.h"} = 1 if not $codeGenerator->AvoidInclusionOfType($implClassName);
    11271132        } else {
    11281133            $implIncludes{"$podType.h"} = 1 unless $podType eq "float";
     
    12281233            my $getterContentTail = ")";
    12291234
    1230             my $svgAnimatedPropertyType = $dataNode->extendedAttributes->{"SVGAnimatedProperty"};
    12311235            if ($svgPropertyType) {
    12321236                $getterContentHead = "$getterExpressionPrefix";
    12331237
    12341238                # TODO: Handle special case for DOMSVGLength. We do need Custom code support for this.
    1235                 if ($svgPropertyType eq "SVGLength" and $attributeName eq "value") {
     1239                if ($svgPropertyType eq "WebCore::SVGLength" and $attributeName eq "value") {
    12361240                    $getterContentHead = "value(0 /* FIXME */";
    12371241                }
     
    12861290            } elsif ($svgPropertyType) {
    12871291                $getterContentHead = "IMPL->propertyReference().$getterContentHead";
    1288             } elsif ($svgAnimatedPropertyType) {
    1289                 if ($idlType =~ /List$/) {
    1290                     $getterContentHead = "kit(static_cast<WebCore::SVGListPropertyTearOff<WebCore::$idlType>*>($getterContentHead)";
    1291                 } else {
    1292                     $getterContentHead = "kit(static_cast<WebCore::SVGPropertyTearOff<WebCore::$idlType>*>($getterContentHead)";
    1293                 }
     1292            } elsif ($codeGenerator->IsSVGNewStyleAnimatedType($implClassName)) {
     1293                my $idlTypeWithNamespace = "WebCore::" . $codeGenerator->GetSVGTypeNeedingTearOff($idlType);
     1294                $idlTypeWithNamespace =~ s/</\<WebCore::/;
     1295                $getterContentHead = "kit(static_cast<$idlTypeWithNamespace*>($getterContentHead)";
    12941296                $getterContentTail .= ")";
    12951297            } elsif (IsProtocolType($idlType) and $idlType ne "EventTarget") {
     
    13031305                $getterContentTail .= "->toString()";               
    13041306            } elsif (ConversionNeeded($attribute->signature->type)) {
    1305                 $getterContentHead = "kit(WTF::getPtr($getterContentHead";
    1306                 $getterContentTail .= "))";
     1307                if ($codeGenerator->IsSVGTypeNeedingTearOff($attribute->signature->type) and not $implClassName =~ /List$/) {
     1308                    my $idlType = $attribute->signature->type;
     1309                    my $idlTypeWithNamespace = "WebCore::" . $codeGenerator->GetSVGTypeNeedingTearOff($idlType);
     1310                    $idlTypeWithNamespace =~ s/</\<WebCore::/;
     1311                    $getterContentHead = "kit(WTF::getPtr(${idlTypeWithNamespace}::create($getterContentHead";
     1312                    $getterContentTail .= ")))";
     1313                } else {
     1314                    $getterContentHead = "kit(WTF::getPtr($getterContentHead";
     1315                    $getterContentTail .= "))";
     1316                }
    13071317            }
    13081318
     
    13701380                if ($svgPropertyType) {
    13711381                    $getterContentHead = "$getterExpressionPrefix";
    1372                     push(@implContent, "    $svgPropertyTypeWithNamespace& podImpl = IMPL->propertyReference();\n");
     1382                    push(@implContent, "    $svgPropertyType& podImpl = IMPL->propertyReference();\n");
    13731383                    my $ec = $hasSetterException ? ", ec" : "";
    13741384                    push(@implContent, "    $exceptionInit\n") if $hasSetterException;
     
    15091519            my $svgMatrixRotateFromVector = ($podType and $podType eq "AffineTransform" and $functionName eq "rotateFromVector");
    15101520            my $svgMatrixInverse = ($podType and $podType eq "AffineTransform" and $functionName eq "inverse");
    1511             my $svgLengthConvertToSpecifiedUnits = ($svgPropertyType and $svgPropertyType eq "SVGLength" and $functionName eq "convertToSpecifiedUnits");
     1521            my $svgLengthConvertToSpecifiedUnits = ($svgPropertyType and $svgPropertyType eq "WebCore::SVGLength" and $functionName eq "convertToSpecifiedUnits");
    15121522
    15131523            push(@parameterNames, "ec") if $raisesExceptions and !($svgMatrixRotateFromVector || $svgMatrixInverse);
     
    15251535
    15261536                my $implGetter = GetObjCTypeGetter($paramName, $idlType);
    1527                 my $idlTypeWithNamespace = ($idlType eq "float") ? "$idlType" : "WebCore::$idlType";
    1528 
    1529                 push(@functionContent, "    WebCore::SVGPropertyTearOff<$idlTypeWithNamespace>* ${paramName}Core = $implGetter;\n");
     1537                my $idlTypeWithNamespace = "WebCore::" . $codeGenerator->GetSVGTypeNeedingTearOff($idlType);
     1538                $idlTypeWithNamespace =~ s/</\<WebCore::/;
     1539
     1540                push(@functionContent, "    $idlTypeWithNamespace* ${paramName}Core = $implGetter;\n");
    15301541                push(@functionContent, "    if (!${paramName}Core) {\n");
    15311542                push(@functionContent, "        WebCore::ExceptionCode ec = WebCore::TYPE_MISMATCH_ERR;\n");
     
    15451556
    15461557            if ($svgPropertyType) {
    1547                 push(@functionContent, "    $svgPropertyTypeWithNamespace& podImpl = IMPL->propertyReference();\n");
     1558                push(@functionContent, "    $svgPropertyType& podImpl = IMPL->propertyReference();\n");
    15481559                $content = "podImpl.$content;\n    IMPL->commitChange()";
    15491560            } else {
     
    15941605                if (ConversionNeeded($function->signature->type)) {
    15951606                    if ($codeGenerator->IsSVGTypeNeedingTearOff($function->signature->type) and not $implClassName =~ /List$/) {
    1596                         $content = "kit(WTF::getPtr(WebCore::SVGPropertyTearOff<WebCore::" . $function->signature->type . ">::create($content)))";
     1607                        my $idlType = $function->signature->type;
     1608                        my $idlTypeWithNamespace = "WebCore::" . $codeGenerator->GetSVGTypeNeedingTearOff($idlType);
     1609                        $idlTypeWithNamespace =~ s/</\<WebCore::/;
     1610                        $content = "kit(WTF::getPtr(${idlTypeWithNamespace}::create($content)))";
    15971611                    } elsif ($codeGenerator->IsPodType($function->signature->type)) {
    15981612                        $content = "kit($content)";
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r70581 r70631  
    213213}
    214214
     215sub GetSVGPropertyTypes
     216{
     217    my $implType = shift;
     218
     219    my $svgPropertyType;
     220    my $svgListPropertyType;
     221    my $svgNativeType;
     222
     223    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $implType =~ /SVG/;
     224
     225    $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implType);
     226    return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $svgNativeType;
     227
     228    # Append space to avoid compilation errors when using  PassRefPtr<$svgNativeType>
     229    $svgNativeType = "$svgNativeType ";
     230
     231    my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implType);
     232    if ($svgNativeType =~ /SVGPropertyTearOff/) {
     233        $svgPropertyType = $svgWrappedNativeType;
     234        $implIncludes{"SVGPropertyTearOff.h"} = 1,
     235    } elsif ($svgNativeType =~ /SVGListPropertyTearOff/) {
     236        $svgListPropertyType = $svgWrappedNativeType;
     237        $implIncludes{"SVGListPropertyTearOff.h"} = 1,
     238    }
     239
     240    return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
     241}
     242
    215243sub GenerateHeader
    216244{
     
    230258    # - Add default header template
    231259    push(@headerContent, GenerateHeaderContentHeader($dataNode));
    232 
    233     # Get correct pass/store types respecting PODType flag
    234260    my $podType = $dataNode->extendedAttributes->{"PODType"};
    235     my $svgPropertyType = $dataNode->extendedAttributes->{"SVGProperty"};
    236     my $svgListPropertyType = $dataNode->extendedAttributes->{"SVGListProperty"};
    237261
    238262    my %headerInclues = ();
    239263    $headerIncludes{"$podType.h"} = 1 if $podType and ($podType ne "double" and $podType ne "float" and $podType ne "RGBA32");
    240     $headerIncludes{"$svgPropertyType.h"} = 1 if $svgPropertyType and $svgPropertyType ne "float";
    241     $headerIncludes{"$svgListPropertyType.h"} = 1 if $svgListPropertyType;
    242     $headerIncludes{"SVGAnimatedProperty.h"} = 1 if $svgPropertyType or $svgListPropertyType;
    243264    $headerIncludes{"wtf/text/StringHash.h"} = 1;
    244265    $headerIncludes{"WrapperTypeInfo.h"} = 1;
    245266    $headerIncludes{"V8DOMWrapper.h"} = 1;
     267
    246268    my $headerClassInclude = GetHeaderClassInclude($implClassName);
    247269    $headerIncludes{$headerClassInclude} = 1 if $headerClassInclude ne "";
     270
     271    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implClassName);
    248272
    249273    foreach my $headerInclude (sort keys(%headerIncludes)) {
     
    686710    my $nativeType = GetNativeTypeFromSignature($attribute->signature, -1);
    687711    my $isPodType = IsPodType($implClassName);
    688     my $svgPropertyType = $dataNode->extendedAttributes->{"SVGProperty"};
    689     my $svgListPropertyType = $dataNode->extendedAttributes->{"SVGListProperty"};
    690712    my $skipContext = 0;
    691713
     
    694716        $implIncludes{"V8SVGPODTypeWrapper.h"} = 1;
    695717    }
    696 
    697     $implIncludes{"SVGPropertyTearOff.h"} = 1 if $svgPropertyType;;
    698     $implIncludes{"SVGListPropertyTearOff.h"} = 1 if $svgListPropertyType;
    699718
    700719    # Special case: SVGZoomEvent's attributes are all read-only
     
    704723    }
    705724
    706     # Special case: SVGSVGEelement::viewport is read-only
    707     if (($implClassName eq "SVGSVGElement") and ($attrName eq "viewport")) {
    708         $attrIsPodType = 0;
    709         $skipContext = 1;
    710     }
    711 
    712725    # Special case for SVGColor
    713726    if (($implClassName eq "SVGColor") and ($attrName eq "rgbColor")) {
     
    716729
    717730    my $getterStringUsesImp = $implClassName ne "float";
     731    my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implClassName);
    718732
    719733    # Getter
     
    737751END
    738752        }
    739 
    740     } elsif ($svgPropertyType) {
    741         push(@implContentDecls, <<END);
    742     SVGPropertyTearOff<$svgPropertyType>* wrapper = V8${implClassName}::toNative(info.Holder());
    743     $svgPropertyType& impInstance = wrapper->propertyReference();
    744     $svgPropertyType* imp = &impInstance;
    745 END
    746     } elsif ($svgListPropertyType) {
    747         push(@implContentDecls, <<END);
    748     SVGListPropertyTearOff<$svgListPropertyType>* imp = V8${implClassName}::toNative(info.Holder());
    749 END
    750     }  elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8DisallowShadowing"}) {
     753    } elsif ($svgNativeType) {
     754        my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName);
     755        if ($svgWrappedNativeType =~ /List$/) {
     756            push(@implContentDecls, <<END);
     757    $svgNativeType* imp = V8${implClassName}::toNative(info.Holder());
     758END
     759        } else {
     760            push(@implContentDecls, <<END);
     761    $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder());
     762    $svgWrappedNativeType& impInstance = wrapper->propertyReference();
     763    $svgWrappedNativeType* imp = &impInstance;
     764END
     765        }
     766    } elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8DisallowShadowing"}) {
    751767        if ($interfaceName eq "DOMWindow") {
    752768            push(@implContentDecls, <<END);
     
    905921
    906922    if ($codeGenerator->IsSVGNewStyleAnimatedType($implClassName)) {
    907         $implIncludes{"V8${attrType}.h"} = 1;
    908         if ($implClassName =~ /List$/) {
    909             push(@implContentDecls, "    return toV8(static_cast<SVGListPropertyTearOff<$attrType>*>($result));\n");
    910          } else {
    911             push(@implContentDecls, "    return toV8(static_cast<SVGPropertyTearOff<$attrType>*>($result));\n");
    912          }
     923        $implIncludes{"V8$attrType.h"} = 1;
     924        my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($attrType);
     925        # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked.
     926        push(@implContentDecls, "    return toV8(static_cast<$svgNativeType*>($result));\n");
     927    } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($attrType) and not $implClassName =~ /List$/) {
     928        $implIncludes{"V8$attrType.h"} = 1;
     929        my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($attrType);
     930        push(@implContentDecls, "    return toV8(WTF::getPtr(${svgNativeType}::create($result)));\n");
    913931    } elsif ($attrIsPodType) {
    914932        $implIncludes{"V8${attrType}.h"} = 1;
     
    962980
    963981    my $isPodType = IsPodType($implClassName);
    964     my $svgPropertyType = $dataNode->extendedAttributes->{"SVGProperty"};
    965     my $svgListPropertyType = $dataNode->extendedAttributes->{"SVGListProperty"};
     982    my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implClassName);
    966983
    967984    if ($isPodType) {
     
    971988        push(@implContentDecls, "    $implClassName impInstance = *wrapper;\n");
    972989        push(@implContentDecls, "    $implClassName* imp = &impInstance;\n");
    973     } elsif ($svgPropertyType) {
    974         push(@implContentDecls, <<END);
    975     SVGPropertyTearOff<$svgPropertyType>* wrapper = V8${implClassName}::toNative(info.Holder());
    976     $svgPropertyType& impInstance = wrapper->propertyReference();
    977     $svgPropertyType* imp = &impInstance;
    978 END
    979     } elsif ($svgListPropertyType) {
    980         push(@implContentDecls, <<END);
    981     SVGListPropertyTearOff<$svgListPropertyType>* imp = V8${implClassName}::toNative(info.Holder());
    982 END
     990    } elsif ($svgNativeType) {
     991        my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName);
     992        if ($svgWrappedNativeType =~ /List$/) {
     993            push(@implContentDecls, <<END);
     994    $svgNativeType* imp = V8${implClassName}::toNative(info.Holder());
     995END
     996        } else {
     997            push(@implContentDecls, <<END);
     998    $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder());
     999    $svgWrappedNativeType& impInstance = wrapper->propertyReference();
     1000    $svgWrappedNativeType* imp = &impInstance;
     1001END
     1002        }
    9831003    } elsif ($attrExt->{"v8OnProto"}) {
    9841004      if ($interfaceName eq "DOMWindow") {
     
    10741094    if ($isPodType) {
    10751095        push(@implContentDecls, "    wrapper->commitChange(*imp, V8Proxy::svgContext(wrapper));\n");
    1076     } elsif ($svgPropertyType) {
     1096    } elsif ($svgNativeType) {
    10771097        if ($useExceptions) {
    10781098            push(@implContentDecls, "    if (!ec)\n");
     
    12811301    }
    12821302
    1283     my $svgPropertyType = $dataNode->extendedAttributes->{"SVGProperty"};
    1284     my $svgListPropertyType = $dataNode->extendedAttributes->{"SVGListProperty"};
     1303    my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implClassName);
    12851304
    12861305    if (IsPodType($implClassName)) {
     
    12891308        push(@implContentDecls, "    $nativeClassName impInstance = *impWrapper;\n");
    12901309        push(@implContentDecls, "    $nativeClassName* imp = &impInstance;\n");
    1291     } elsif ($svgPropertyType) {
    1292         my $nativeClassName = GetNativeType($implClassName);
    1293         push(@implContentDecls, "    $nativeClassName wrapper = V8${svgPropertyType}::toNative(args.Holder());\n");
    1294         push(@implContentDecls, "    $svgPropertyType& impInstance = wrapper->propertyReference();\n");
    1295         push(@implContentDecls, "    $svgPropertyType* imp = &impInstance;\n");
    1296     } elsif ($svgListPropertyType) {
    1297         my $nativeClassName = GetNativeType($implClassName);
    1298         push(@implContentDecls, "    $nativeClassName imp = V8${svgListPropertyType}::toNative(args.Holder());\n");
     1310    } elsif ($svgNativeType) {
     1311        my $nativeClassName = GetNativeType($implClassName);
     1312        if ($implClassName =~ /List$/) {
     1313            push(@implContentDecls, "    $nativeClassName imp = V8${svgListPropertyType}::toNative(args.Holder());\n");
     1314        } else {
     1315            my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName);
     1316            push(@implContentDecls, "    $nativeClassName wrapper = V8${svgPropertyType}::toNative(args.Holder());\n");
     1317            push(@implContentDecls, "    $svgWrappedNativeType& impInstance = wrapper->propertyReference();\n");
     1318            push(@implContentDecls, "    $svgWrappedNativeType* imp = &impInstance;\n");
     1319        }
    12991320    } elsif (!$function->signature->extendedAttributes->{"ClassMethod"}) {
    13001321        push(@implContentDecls, <<END);
     
    26462667    my $type = shift;
    26472668
    2648     $type = "FloatRect" if $type eq "SVGRect";
    26492669    $type = "FloatPoint" if $type eq "SVGPoint";
    26502670    $type = "AffineTransform" if $type eq "SVGMatrix";
    26512671    $type = "float" if $type eq "SVGNumber";
    26522672    $type = "V8SVGPODTypeWrapper<$type>" if $dataNode->extendedAttributes->{"PODType"};
    2653     $type = "SVGPropertyTearOff<$type>" if $dataNode->extendedAttributes->{"SVGProperty"};
    2654     $type = "SVGListPropertyTearOff<$type>" if $dataNode->extendedAttributes->{"SVGListProperty"};
     2673    $type = $codeGenerator->GetSVGTypeNeedingTearOff($type) if $codeGenerator->IsSVGTypeNeedingTearOff($type);
    26552674    return $type;
    26562675}
     
    26692688    my $nativeReturnType = GetNativeType($returnType, 0);
    26702689    my $result = "";
     2690
     2691    my $isSVGTearOffType = ($codeGenerator->IsSVGTypeNeedingTearOff($returnType) and not $implClassName =~ /List$/);
     2692    $nativeReturnType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($returnType) if $isSVGTearOffType;
    26712693
    26722694    # Special case: SVG matrix transform methods should not mutate
     
    28172839    }
    28182840
    2819     if ($codeGenerator->IsSVGTypeNeedingTearOff($returnType) and not $implClassName =~ /List$/) {
     2841    if ($isSVGTearOffType) {
    28202842        $implIncludes{"V8$returnType.h"} = 1;
    28212843        $implIncludes{"SVGPropertyTearOff.h"} = 1;
    2822         return $indent . "return toV8(WTF::getPtr(SVGPropertyTearOff<$returnType>::create($return)));\n";
     2844        my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($returnType);
     2845        $result .= $indent . "return toV8(WTF::getPtr(${svgNativeType}::create($return)));\n";
     2846        return $result;
    28232847    }
    28242848
     
    28482872
    28492873        $result .= $indent . "impWrapper->commitChange(impInstance, context);\n";
    2850     } elsif ($dataNode->extendedAttributes->{"SVGProperty"}) {
     2874    } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($implClassName) and not $implClassName =~ /List$/) {
    28512875        $result .= $indent . "wrapper->commitChange();\n";
    28522876    }
     
    29242948    my $isParameter = shift;
    29252949
     2950    my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
     2951    if ($svgNativeType) {
     2952        if ($svgNativeType =~ /List$/) {
     2953            return "${svgNativeType}*";
     2954        } else {
     2955            return "RefPtr<${svgNativeType} >";
     2956        }
     2957    }
     2958
    29262959    if ($type eq "float" or $type eq "double") {
    29272960        return $type;
     
    29382971    return "String" if $type eq "DOMString";
    29392972    return "Range::CompareHow" if $type eq "CompareHow";
    2940     return "FloatRect" if $type eq "SVGRect";
    29412973    return "FloatPoint" if $type eq "SVGPoint";
    29422974    return "AffineTransform" if $type eq "SVGMatrix";
    29432975    return "SVGTransform" if $type eq "SVGTransform";
    2944     return "RefPtr<SVGPropertyTearOff<SVGAngle> >" if $type eq "SVGAngle";
    2945     return "RefPtr<SVGPropertyTearOff<SVGLength> >" if $type eq "SVGLength";
    2946     return "SVGListPropertyTearOff<SVGLengthList>*" if $type eq "SVGLengthList";
    29472976    return "float" if $type eq "SVGNumber";
    29482977    return "SVGPreserveAspectRatio" if $type eq "SVGPreserveAspectRatio";
     
    29993028    return 1 if $type eq "SVGPoint";
    30003029    return 1 if $type eq "SVGPreserveAspectRatio";
    3001     return 1 if $type eq "SVGRect";
    30023030    return 1 if $type eq "SVGTransform";
    30033031    return 0;
     
    33803408    my $implClassName = shift;
    33813409
     3410    return 0 unless $implClassName =~ /SVG/;
     3411    return 0 if $implClassName =~ /Element/;
    33823412    return 0 if $codeGenerator->IsSVGNewStyleAnimatedType($implClassName);
    3383     if ($implClassName =~ /SVG/ and not $implClassName =~ /Element/) {
    3384         return 1 unless $implClassName =~ /SVGAngle/
    3385                      or $implClassName =~ /SVGPaint/
    3386                      or $implClassName =~ /SVGColor/
    3387                      or $implClassName =~ /SVGDocument/
    3388                      or $implClassName =~ /SVGLength/
    3389                      or $implClassName =~ /SVGLengthList/;
    3390     }
    3391 
    3392     return 0;
     3413    return 0 if $codeGenerator->IsSVGTypeNeedingTearOff($implClassName);
     3414
     3415    my @noContextNeeded = ("SVGColor", "SVGDocument", "SVGPaintType", "SVGPaint", "SVGZoomEvent");
     3416    foreach (@noContextNeeded) {
     3417        return 0 if $implClassName eq $_;
     3418    }
     3419    return 1;
    33933420}
    33943421
  • trunk/WebCore/svg/DeprecatedSVGAnimatedPropertyTraits.h

    r70581 r70631  
    106106};
    107107
    108 // SVGAnimatedRect
    109 template<>
    110 struct DeprecatedSVGAnimatedPropertyTraits<FloatRect> : public Noncopyable {
    111     typedef const FloatRect& PassType;
    112     typedef FloatRect ReturnType;
    113     typedef FloatRect StoredType;
    114 
    115     static ReturnType null() { return FloatRect(); }
    116     static ReturnType toReturnType(const StoredType& type) { return type; }
    117     static String toString(PassType type) { return String::format("%f %f %f %f", type.x(), type.y(), type.width(), type.height()); }
    118 };
    119 
    120108// SVGAnimatedString
    121109template<>
  • trunk/WebCore/svg/DeprecatedSVGAnimatedTemplate.h

    r70581 r70631  
    161161    typedef DeprecatedSVGAnimatedTemplate<SVGNumberList*> SVGAnimatedNumberList;
    162162    typedef DeprecatedSVGAnimatedTemplate<SVGPreserveAspectRatio> SVGAnimatedPreserveAspectRatio;
    163     typedef DeprecatedSVGAnimatedTemplate<FloatRect> SVGAnimatedRect;
    164163    typedef DeprecatedSVGAnimatedTemplate<String> SVGAnimatedString;
    165164    typedef DeprecatedSVGAnimatedTemplate<SVGTransformList*> SVGAnimatedTransformList;
  • trunk/WebCore/svg/SVGAngle.idl

    r70581 r70631  
    2323module svg {
    2424
    25     interface [Conditional=SVG, SVGProperty=SVGAngle] SVGAngle {
     25    interface [Conditional=SVG] SVGAngle {
    2626        // Angle Unit Types
    2727        const unsigned short SVG_ANGLETYPE_UNKNOWN = 0;
  • trunk/WebCore/svg/SVGAnimatedAngle.idl

    r70581 r70631  
    2626module svg {
    2727
    28     interface [Conditional=SVG, SVGAnimatedProperty] SVGAnimatedAngle {
     28    interface [Conditional=SVG] SVGAnimatedAngle {
    2929        readonly attribute SVGAngle baseVal;
    3030        readonly attribute SVGAngle animVal;
  • trunk/WebCore/svg/SVGAnimatedLength.idl

    r70581 r70631  
    2626module svg {
    2727
    28     interface [Conditional=SVG, SVGAnimatedProperty] SVGAnimatedLength {
     28    interface [Conditional=SVG] SVGAnimatedLength {
    2929        readonly attribute SVGLength baseVal;
    3030        readonly attribute SVGLength animVal;
  • trunk/WebCore/svg/SVGAnimatedLengthList.idl

    r70581 r70631  
    2626module svg {
    2727
    28     interface [Conditional=SVG, SVGAnimatedProperty] SVGAnimatedLengthList {
     28    interface [Conditional=SVG] SVGAnimatedLengthList {
    2929        readonly attribute SVGLengthList baseVal;
    3030        readonly attribute SVGLengthList animVal;
  • trunk/WebCore/svg/SVGFitToViewBox.h

    r70581 r70631  
    4040    bool isKnownAttribute(const QualifiedName&);
    4141
    42     virtual void setViewBoxBaseValue(DeprecatedSVGAnimatedPropertyTraits<FloatRect>::PassType) = 0;
     42    virtual void setViewBoxBaseValue(const FloatRect&) = 0;
    4343    virtual void setPreserveAspectRatioBaseValue(DeprecatedSVGAnimatedPropertyTraits<SVGPreserveAspectRatio>::PassType) = 0;
    4444
  • trunk/WebCore/svg/SVGLength.idl

    r70581 r70631  
    2323module svg {
    2424
    25     interface [Conditional=SVG, SVGProperty=SVGLength] SVGLength {
     25    interface [Conditional=SVG] SVGLength {
    2626        // Length Unit Types
    2727        const unsigned short SVG_LENGTHTYPE_UNKNOWN    = 0;
  • trunk/WebCore/svg/SVGMarkerElement.h

    r70581 r70631  
    8989
    9090    // SVGFitToViewBox
    91     DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
     91    DECLARE_ANIMATED_PROPERTY_NEW(SVGMarkerElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
    9292    DECLARE_ANIMATED_PROPERTY(SVGMarkerElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
    9393};
  • trunk/WebCore/svg/SVGPatternElement.h

    r70581 r70631  
    8080
    8181        // SVGPatternElement
    82         DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
     82        DECLARE_ANIMATED_PROPERTY_NEW(SVGPatternElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
    8383        DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
    8484    };
  • trunk/WebCore/svg/SVGRect.idl

    r70581 r70631  
    2323module svg {
    2424
    25     interface [Conditional=SVG, PODType=FloatRect] SVGRect {
    26         attribute float x;
    27         attribute float y;
    28         attribute float width;
    29         attribute float height;
     25    interface [Conditional=SVG] SVGRect {
     26        attribute [StrictTypeChecking] float x;
     27        attribute [StrictTypeChecking] float y;
     28        attribute [StrictTypeChecking] float width;
     29        attribute [StrictTypeChecking] float height;
    3030    };
    3131
  • trunk/WebCore/svg/SVGSVGElement.cpp

    r70581 r70631  
    187187{
    188188    if (!m_viewSpec)
    189         m_viewSpec = adoptPtr(new SVGViewSpec(this));
     189        m_viewSpec = adoptPtr(new SVGViewSpec(const_cast<SVGSVGElement*>(this)));
    190190    return m_viewSpec.get();
    191191}
     
    581581    setUseCurrentView(true);
    582582    if (viewElement->hasAttribute(SVGNames::viewBoxAttr))
    583         currentView()->setViewBox(viewElement->viewBox());
     583        currentView()->setViewBoxBaseValue(viewElement->viewBox());
    584584    else
    585         currentView()->setViewBox(viewBox());
     585        currentView()->setViewBoxBaseValue(viewBox());
    586586
    587587    SVGPreserveAspectRatio aspectRatio;
  • trunk/WebCore/svg/SVGSVGElement.h

    r70581 r70631  
    147147
    148148        // SVGFitToViewBox
    149         DECLARE_ANIMATED_PROPERTY(SVGSVGElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
     149        DECLARE_ANIMATED_PROPERTY_NEW(SVGSVGElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
    150150        DECLARE_ANIMATED_PROPERTY(SVGSVGElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
    151151 
  • trunk/WebCore/svg/SVGSVGElement.idl

    r70581 r70631  
    4242                 attribute DOMString contentStyleType
    4343                     /*setter raises(DOMException)*/;
    44         readonly attribute [Immutable] SVGRect viewport;
     44        readonly attribute SVGRect viewport;
    4545        readonly attribute float pixelUnitToMillimeterX;
    4646        readonly attribute float pixelUnitToMillimeterY;
     
    4949                 attribute boolean useCurrentView
    5050                     /*setter raises(DOMException)*/;
    51         // TODO    readonly attribute [Immutable] SVGViewSpec currentView;
     51        // TODO    readonly attribute SVGViewSpec currentView;
    5252                 attribute float currentScale
    5353                     /*setter raises(DOMException)*/;
  • trunk/WebCore/svg/SVGSymbolElement.h

    r70581 r70631  
    2323
    2424#if ENABLE(SVG)
     25#include "SVGAnimatedPropertyMacros.h"
    2526#include "SVGExternalResourcesRequired.h"
    2627#include "SVGFitToViewBox.h"
     
    5152 
    5253        // SVGFitToViewBox
    53         DECLARE_ANIMATED_PROPERTY(SVGSymbolElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
     54        DECLARE_ANIMATED_PROPERTY_NEW(SVGSymbolElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
    5455        DECLARE_ANIMATED_PROPERTY(SVGSymbolElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
    5556    };
  • trunk/WebCore/svg/SVGViewElement.h

    r70581 r70631  
    2323
    2424#if ENABLE(SVG)
     25#include "SVGAnimatedPropertyMacros.h"
    2526#include "SVGStyledElement.h"
    2627#include "SVGExternalResourcesRequired.h"
     
    5253 
    5354        // SVGFitToViewBox
    54         DECLARE_ANIMATED_PROPERTY(SVGViewElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
     55        DECLARE_ANIMATED_PROPERTY_NEW(SVGViewElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
    5556        DECLARE_ANIMATED_PROPERTY(SVGViewElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
    5657 
  • trunk/WebCore/svg/SVGViewSpec.cpp

    r70581 r70631  
    3232namespace WebCore {
    3333
    34 SVGViewSpec::SVGViewSpec(const SVGSVGElement* contextElement)
     34SVGViewSpec::SVGViewSpec(SVGElement* contextElement)
    3535    : m_contextElement(contextElement)
    3636    , m_transform(SVGTransformList::create(SVGNames::transformAttr))
  • trunk/WebCore/svg/SVGViewSpec.h

    r70581 r70631  
    2222
    2323#if ENABLE(SVG)
     24#include "SVGAnimatedPropertyMacros.h"
     25#include "SVGElement.h"
    2426#include "SVGFitToViewBox.h"
    2527#include "SVGZoomAndPan.h"
     
    3032
    3133    class SVGElement;
    32     class SVGSVGElement;
    3334    class SVGTransformList;
    3435
     
    3738                        public Noncopyable {
    3839    public:
    39         SVGViewSpec(const SVGSVGElement*);
     40        SVGViewSpec(SVGElement*);
    4041
    4142        bool parseViewSpec(const String&);
     
    5253        SVGElement* viewTarget() const;
    5354
    54         SVGSVGElement* contextElement() const { return const_cast<SVGSVGElement*>(m_contextElement); }
     55        SVGElement* contextElement() const { return const_cast<SVGElement*>(m_contextElement); }
    5556
    5657    private:
    57         const SVGSVGElement* m_contextElement;
     58        SVGElement* m_contextElement;
    5859
    5960        // SVGFitToViewBox
    60         DECLARE_ANIMATED_PROPERTY(SVGViewSpec, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
     61        DECLARE_ANIMATED_PROPERTY_NEW(SVGViewSpec, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox)
    6162        DECLARE_ANIMATED_PROPERTY(SVGViewSpec, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio)
    6263
  • trunk/WebCore/svg/SVGZoomEvent.idl

    r70581 r70631  
    2727
    2828    interface [Conditional=SVG] SVGZoomEvent : UIEvent {
    29         readonly attribute [Immutable] SVGRect zoomRectScreen;
     29        readonly attribute SVGRect zoomRectScreen;
    3030        readonly attribute float previousScale;
    3131        readonly attribute [Immutable] SVGPoint previousTranslate;
  • trunk/WebCore/svg/properties/SVGAnimatedPropertyMacros.h

    r70581 r70631  
    7474{ \
    7575    m_##LowerProperty.value = type; \
    76     invalidateSVGAttributes(); \
     76    SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \
     77    contextElement->invalidateSVGAttributes(); \
    7778} \
    7879\
     
    8283         return; \
    8384    AtomicString value(SVGPropertyTraits<PropertyType>::toString(LowerProperty##BaseValue())); \
    84     SVGAnimatedPropertySynchronizer<IsDerivedFromSVGElement<OwnerType>::value>::synchronize(this, DOMAttribute, value); \
     85    SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \
     86    SVGAnimatedPropertySynchronizer<IsDerivedFromSVGElement<OwnerType>::value>::synchronize(contextElement, DOMAttribute, value); \
    8587} \
    8688\
     
    8890{ \
    8991    m_##LowerProperty.shouldSynchronize = true; \
    90     return SVGAnimatedProperty::lookupOrCreateWrapper<TearOffType, PropertyType>(this, DOMAttribute, SVGDOMAttributeIdentifier, m_##LowerProperty.value); \
     92    SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \
     93    return SVGAnimatedProperty::lookupOrCreateWrapper<TearOffType, PropertyType>(contextElement, DOMAttribute, SVGDOMAttributeIdentifier, m_##LowerProperty.value); \
    9194} \
    9295private: \
     
    104107void detachAnimated##UpperProperty##ListWrappers(unsigned newListSize) \
    105108{ \
    106     SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGAnimatedListPropertyTearOff<PropertyType> >(this, DOMAttribute.localName()); \
     109    SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \
     110    SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGAnimatedListPropertyTearOff<PropertyType> >(contextElement, DOMAttribute.localName()); \
    107111    if (!wrapper) \
    108112        return; \
Note: See TracChangeset for help on using the changeset viewer.