Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 153883003: [SVG] SVGAnimatedTransform{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove m_zoomAndPan Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
5 # Copyright (C) 2006 Apple Computer, Inc. 5 # Copyright (C) 2006 Apple Computer, Inc.
6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 # Copyright (C) 2012 Ericsson AB. All rights reserved. 10 # Copyright (C) 2012 Ericsson AB. All rights reserved.
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 "SVGLength" => 1, 239 "SVGLength" => 1,
240 "SVGLengthList" => 1, 240 "SVGLengthList" => 1,
241 "SVGNumber" => 1, 241 "SVGNumber" => 1,
242 "SVGNumberList" => 1, 242 "SVGNumberList" => 1,
243 "SVGPoint" => 1, 243 "SVGPoint" => 1,
244 "SVGPointList" => 1, 244 "SVGPointList" => 1,
245 "SVGPreserveAspectRatio" => 1, 245 "SVGPreserveAspectRatio" => 1,
246 "SVGRect" => 1, 246 "SVGRect" => 1,
247 "SVGString" => 1, 247 "SVGString" => 1,
248 "SVGStringList" => 1, 248 "SVGStringList" => 1,
249 "SVGTransform" => 1,
250 "SVGTransformList" => 1,
249 ); 251 );
250 252
251 my %svgTypeNeedingTearOff = ( 253 my %svgTypeNeedingTearOff = (
252 "SVGMatrix" => "SVGMatrixTearOff",
253 "SVGPathSegList" => "SVGPathSegListPropertyTearOff", 254 "SVGPathSegList" => "SVGPathSegListPropertyTearOff",
254 "SVGTransform" => "SVGPropertyTearOff<SVGTransform>",
255 "SVGTransformList" => "SVGTransformListPropertyTearOff"
256 );
257
258 my %svgTypeWithWritablePropertiesNeedingTearOff = (
259 "SVGMatrix" => 1
260 ); 255 );
261 256
262 # Default license header 257 # Default license header
263 my $licenseHeader = <<EOF; 258 my $licenseHeader = <<EOF;
264 /* 259 /*
265 * Copyright (C) 2013 Google Inc. All rights reserved. 260 * Copyright (C) 2013 Google Inc. All rights reserved.
266 * 261 *
267 * Redistribution and use in source and binary forms, with or without 262 * Redistribution and use in source and binary forms, with or without
268 * modification, are permitted provided that the following conditions are 263 * modification, are permitted provided that the following conditions are
269 * met: 264 * met:
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 END 547 END
553 } 548 }
554 for my $setReference (@{$interface->extendedAttributes->{"SetWrapperReferenc eTo"}}) { 549 for my $setReference (@{$interface->extendedAttributes->{"SetWrapperReferenc eTo"}}) {
555 my $setReferenceType = $setReference->type; 550 my $setReferenceType = $setReference->type;
556 my $setReferenceV8Type = "V8".$setReferenceType; 551 my $setReferenceV8Type = "V8".$setReferenceType;
557 552
558 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProp ertyTypes($setReferenceType); 553 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProp ertyTypes($setReferenceType);
559 if ($svgPropertyType) { 554 if ($svgPropertyType) {
560 $setReferenceType = $svgNativeType; 555 $setReferenceType = $svgNativeType;
561 } 556 }
557 my $setReferenceImplType = GetImplNameFromImplementedBy($setReferenceTyp e);
562 558
563 my $setReferenceName = $setReference->name; 559 my $setReferenceName = $setReference->name;
564 560
565 AddIncludesForType($setReferenceType); 561 AddIncludesForType($setReferenceType);
566 $code .= <<END; 562 $code .= <<END;
567 ${setReferenceType}* ${setReferenceName} = impl->${setReferenceName}(); 563 ${setReferenceImplType}* ${setReferenceName} = impl->${setReferenceName}();
568 if (${setReferenceName}) { 564 if (${setReferenceName}) {
569 if (!DOMDataStore::containsWrapper<${setReferenceV8Type}>(${setReference Name}, isolate)) 565 if (!DOMDataStore::containsWrapper<${setReferenceV8Type}>(${setReference Name}, isolate))
570 wrap(${setReferenceName}, creationContext, isolate); 566 wrap(${setReferenceName}, creationContext, isolate);
571 DOMDataStore::setWrapperReference<${setReferenceV8Type}>(wrapper, ${setR eferenceName}, isolate); 567 DOMDataStore::setWrapperReference<${setReferenceV8Type}>(wrapper, ${setR eferenceName}, isolate);
572 } 568 }
573 END 569 END
574 } 570 }
575 571
576 my $isReachableMethod = $interface->extendedAttributes->{"SetWrapperReferenc eFrom"}; 572 my $isReachableMethod = $interface->extendedAttributes->{"SetWrapperReferenc eFrom"};
577 if ($isReachableMethod) { 573 if ($isReachableMethod) {
(...skipping 29 matching lines...) Expand all
607 $svgNativeType = GetSVGTypeNeedingTearOff($implType); 603 $svgNativeType = GetSVGTypeNeedingTearOff($implType);
608 return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $svgN ativeType; 604 return ($svgPropertyType, $svgListPropertyType, $svgNativeType) if not $svgN ativeType;
609 605
610 # Append space to avoid compilation errors when using PassRefPtr<$svgNative Type> 606 # Append space to avoid compilation errors when using PassRefPtr<$svgNative Type>
611 $svgNativeType = "$svgNativeType "; 607 $svgNativeType = "$svgNativeType ";
612 608
613 my $svgWrappedNativeType = GetSVGWrappedTypeNeedingTearOff($implType); 609 my $svgWrappedNativeType = GetSVGWrappedTypeNeedingTearOff($implType);
614 if ($svgNativeType =~ /SVGPropertyTearOff/) { 610 if ($svgNativeType =~ /SVGPropertyTearOff/) {
615 $svgPropertyType = $svgWrappedNativeType; 611 $svgPropertyType = $svgWrappedNativeType;
616 AddToHeaderIncludes("core/svg/properties/SVGAnimatedPropertyTearOff.h"); 612 AddToHeaderIncludes("core/svg/properties/SVGAnimatedPropertyTearOff.h");
617 } elsif ($svgNativeType =~ /SVGMatrixTearOff/) {
618 $svgPropertyType = $svgWrappedNativeType;
619 AddToHeaderIncludes("core/svg/properties/SVGMatrixTearOff.h");
620 AddToHeaderIncludes("core/svg/properties/SVGAnimatedPropertyTearOff.h");
621 } elsif ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SV GStaticListPropertyTearOff/ or $svgNativeType =~ /SVGTransformListPropertyTearOf f/) { 613 } elsif ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SV GStaticListPropertyTearOff/ or $svgNativeType =~ /SVGTransformListPropertyTearOf f/) {
622 $svgListPropertyType = $svgWrappedNativeType; 614 $svgListPropertyType = $svgWrappedNativeType;
623 AddToHeaderIncludes("core/svg/properties/SVGAnimatedListPropertyTearOff. h"); 615 AddToHeaderIncludes("core/svg/properties/SVGAnimatedListPropertyTearOff. h");
624 } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) { 616 } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) {
625 $svgListPropertyType = $svgWrappedNativeType; 617 $svgListPropertyType = $svgWrappedNativeType;
626 AddToHeaderIncludes("core/svg/properties/SVGPathSegListPropertyTearOff.h "); 618 AddToHeaderIncludes("core/svg/properties/SVGPathSegListPropertyTearOff.h ");
627 } 619 }
628 620
629 return ($svgPropertyType, $svgListPropertyType, $svgNativeType); 621 return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
630 } 622 }
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 if ($forMainWorldSuffix eq "ForMainWorld") { 1695 if ($forMainWorldSuffix eq "ForMainWorld") {
1704 $code .= " v8SetReturnValueForMainWorld(info, static_cast<$svgNat iveType*>($expression));\n"; 1696 $code .= " v8SetReturnValueForMainWorld(info, static_cast<$svgNat iveType*>($expression));\n";
1705 } else { 1697 } else {
1706 $code .= " v8SetReturnValueFast(info, static_cast<$svgNativeType* >($expression), imp);\n"; 1698 $code .= " v8SetReturnValueFast(info, static_cast<$svgNativeType* >($expression), imp);\n";
1707 } 1699 }
1708 } elsif (IsSVGTypeNeedingTearOff($attrType) and not $interfaceName =~ /List$ /) { 1700 } elsif (IsSVGTypeNeedingTearOff($attrType) and not $interfaceName =~ /List$ /) {
1709 AddToImplIncludes("V8$attrType.h"); 1701 AddToImplIncludes("V8$attrType.h");
1710 AddToImplIncludes("core/svg/properties/SVGPropertyTearOff.h"); 1702 AddToImplIncludes("core/svg/properties/SVGPropertyTearOff.h");
1711 my $tearOffType = GetSVGTypeNeedingTearOff($attrType); 1703 my $tearOffType = GetSVGTypeNeedingTearOff($attrType);
1712 my $wrappedValue; 1704 my $wrappedValue;
1713 if (IsSVGTypeWithWritablePropertiesNeedingTearOff($attrType) and not def ined $attribute->extendedAttributes->{"Immutable"}) { 1705 if ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
1714 my $getter = $expression;
1715 $getter =~ s/imp->//;
1716 $getter =~ s/\(\)//;
1717
1718 my $updateMethod = "&${implClassName}::update" . FirstLetterToUpperC ase($getter);
1719
1720 my $selfIsTearOffType = IsSVGTypeNeedingTearOff($interfaceName);
1721 if ($selfIsTearOffType) {
1722 AddToImplIncludes("core/svg/properties/SVGMatrixTearOff.h");
1723 # FIXME: Don't create a new one everytime we access the matrix p roperty. This means, e.g, === won't work.
1724 $wrappedValue = "WTF::getPtr(SVGMatrixTearOff::create(wrapper, $ expression))";
1725 } else {
1726 AddToImplIncludes("core/svg/properties/SVGStaticPropertyTearOff. h");
1727 $tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$ implClassName, /;
1728
1729 $wrappedValue = "WTF::getPtr(${tearOffType}::create(imp, $expres sion, $updateMethod))";
1730 }
1731 } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
1732 $wrappedValue = "WTF::getPtr(${tearOffType}::create(imp, $expres sion))"; 1706 $wrappedValue = "WTF::getPtr(${tearOffType}::create(imp, $expres sion))";
1733 } elsif ($tearOffType =~ /SVG(Point|PathSeg)List/) { 1707 } elsif ($tearOffType =~ /SVG(Point|PathSeg)List/) {
1734 $wrappedValue = "WTF::getPtr($expression)"; 1708 $wrappedValue = "WTF::getPtr($expression)";
1735 } else { 1709 } else {
1736 $wrappedValue = "WTF::getPtr(${tearOffType}::create($expression) )"; 1710 $wrappedValue = "WTF::getPtr(${tearOffType}::create($expression) )";
1737 } 1711 }
1738 if ($forMainWorldSuffix eq "ForMainWorld") { 1712 if ($forMainWorldSuffix eq "ForMainWorld") {
1739 $code .= " v8SetReturnValueForMainWorld(info, $wrappedValue);\n"; 1713 $code .= " v8SetReturnValueForMainWorld(info, $wrappedValue);\n";
1740 } else { 1714 } else {
1741 $code .= " v8SetReturnValueFast(info, $wrappedValue, imp);\n"; 1715 $code .= " v8SetReturnValueFast(info, $wrappedValue, imp);\n";
(...skipping 3586 matching lines...) Expand 10 before | Expand all | Expand 10 after
5328 } 5302 }
5329 END 5303 END
5330 } else { 5304 } else {
5331 $code .= <<END; 5305 $code .= <<END;
5332 if (!$paramName) { 5306 if (!$paramName) {
5333 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfac eName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }' .\"), info.GetIsolate()); 5307 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfac eName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }' .\"), info.GetIsolate());
5334 return; 5308 return;
5335 } 5309 }
5336 END 5310 END
5337 } 5311 }
5338 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans formList") {
5339 push @arguments, "$paramName.get()";
5340 } elsif (IsNullableParameter($parameter)) { 5312 } elsif (IsNullableParameter($parameter)) {
5341 push @arguments, "${paramName}IsNull ? 0 : &$paramName"; 5313 push @arguments, "${paramName}IsNull ? 0 : &$paramName";
5342 } elsif (IsCallbackInterface($paramType) or $paramType eq "NodeFilter" o r $paramType eq "XPathNSResolver") { 5314 } elsif (IsCallbackInterface($paramType) or $paramType eq "NodeFilter" o r $paramType eq "XPathNSResolver") {
5343 push @arguments, "$paramName.release()"; 5315 push @arguments, "$paramName.release()";
5344 } else { 5316 } else {
5345 push @arguments, $paramName; 5317 push @arguments, $paramName;
5346 } 5318 }
5347 $index++; 5319 $index++;
5348 $humanFriendlyIndex = $index + 1; 5320 $humanFriendlyIndex = $index + 1;
5349 } 5321 }
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
6028 } 6000 }
6029 6001
6030 sub IsSVGTypeNeedingTearOff 6002 sub IsSVGTypeNeedingTearOff
6031 { 6003 {
6032 my $type = shift; 6004 my $type = shift;
6033 6005
6034 return 1 if $svgTypeNeedingTearOff{$type}; 6006 return 1 if $svgTypeNeedingTearOff{$type};
6035 return 0; 6007 return 0;
6036 } 6008 }
6037 6009
6038 sub IsSVGTypeWithWritablePropertiesNeedingTearOff
6039 {
6040 my $type = shift;
6041
6042 return 1 if $svgTypeWithWritablePropertiesNeedingTearOff{$type};
6043 return 0;
6044 }
6045
6046 sub IsTypedArrayType 6010 sub IsTypedArrayType
6047 { 6011 {
6048 my $type = shift; 6012 my $type = shift;
6049 return 1 if $typedArrayHash{$type}; 6013 return 1 if $typedArrayHash{$type};
6050 return 0; 6014 return 0;
6051 } 6015 }
6052 6016
6053 sub IsWillBeGarbageCollectedType 6017 sub IsWillBeGarbageCollectedType
6054 { 6018 {
6055 my $interfaceName = shift; 6019 my $interfaceName = shift;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
6098 return $svgTypeNeedingTearOff if not $svgTypeNeedingTearOff; 6062 return $svgTypeNeedingTearOff if not $svgTypeNeedingTearOff;
6099 6063
6100 if ($svgTypeNeedingTearOff =~ /SVGPropertyTearOff/) { 6064 if ($svgTypeNeedingTearOff =~ /SVGPropertyTearOff/) {
6101 $svgTypeNeedingTearOff =~ s/SVGPropertyTearOff<//; 6065 $svgTypeNeedingTearOff =~ s/SVGPropertyTearOff<//;
6102 } elsif ($svgTypeNeedingTearOff =~ /SVGListPropertyTearOff/) { 6066 } elsif ($svgTypeNeedingTearOff =~ /SVGListPropertyTearOff/) {
6103 $svgTypeNeedingTearOff =~ s/SVGListPropertyTearOff<//; 6067 $svgTypeNeedingTearOff =~ s/SVGListPropertyTearOff<//;
6104 } elsif ($svgTypeNeedingTearOff =~ /SVGStaticListPropertyTearOff/) { 6068 } elsif ($svgTypeNeedingTearOff =~ /SVGStaticListPropertyTearOff/) {
6105 $svgTypeNeedingTearOff =~ s/SVGStaticListPropertyTearOff<//; 6069 $svgTypeNeedingTearOff =~ s/SVGStaticListPropertyTearOff<//;
6106 } elsif ($svgTypeNeedingTearOff =~ /SVGTransformListPropertyTearOff/) { 6070 } elsif ($svgTypeNeedingTearOff =~ /SVGTransformListPropertyTearOff/) {
6107 $svgTypeNeedingTearOff =~ s/SVGTransformListPropertyTearOff<//; 6071 $svgTypeNeedingTearOff =~ s/SVGTransformListPropertyTearOff<//;
6108 } elsif ($svgTypeNeedingTearOff =~ /SVGMatrixTearOff/) {
6109 $svgTypeNeedingTearOff = 'SVGMatrix';
6110 } 6072 }
6111 6073
6112 $svgTypeNeedingTearOff =~ s/>//; 6074 $svgTypeNeedingTearOff =~ s/>//;
6113 return $svgTypeNeedingTearOff; 6075 return $svgTypeNeedingTearOff;
6114 } 6076 }
6115 6077
6116 sub IsSVGAnimatedType 6078 sub IsSVGAnimatedType
6117 { 6079 {
6118 my $type = shift; 6080 my $type = shift;
6119 6081
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
6486 if ($parameter->type eq "SerializedScriptValue") { 6448 if ($parameter->type eq "SerializedScriptValue") {
6487 return 1; 6449 return 1;
6488 } elsif (IsIntegerType($parameter->type)) { 6450 } elsif (IsIntegerType($parameter->type)) {
6489 return 1; 6451 return 1;
6490 } 6452 }
6491 } 6453 }
6492 return 0; 6454 return 0;
6493 } 6455 }
6494 6456
6495 1; 6457 1;
OLDNEW
« no previous file with comments | « LayoutTests/svg/hixie/transform/001-expected.txt ('k') | Source/bindings/tests/idls/TestInterface.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698