Title: [152845] trunk/Source/WebCore
Revision
152845
Author
[email protected]
Date
2013-07-18 07:51:53 -0700 (Thu, 18 Jul 2013)

Log Message

Simplify SVG animated type handling in the JSC bindings generator
https://bugs.webkit.org/show_bug.cgi?id=118845

Reviewed by Kentaro Hara.

Simplify IsSVGAnimatedType subroutine in the bindings generator so that
we no longer need to hardcode SVG animated types. Also remove the
CanUseFastAttribute subroutine as it is equivalent to IsSVGAnimatedType.
This allows us to simplify the GetterExpression subroutine so that
we can use fastHasAttribute() unconditionally for boolean type.

No new tests, no behavior change.

* bindings/scripts/CodeGenerator.pm:
(IsSVGAnimatedType):
(GetterExpression):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152844 => 152845)


--- trunk/Source/WebCore/ChangeLog	2013-07-18 14:24:52 UTC (rev 152844)
+++ trunk/Source/WebCore/ChangeLog	2013-07-18 14:51:53 UTC (rev 152845)
@@ -1,5 +1,24 @@
 2013-07-18  Christophe Dumez  <[email protected]>
 
+        Simplify SVG animated type handling in the JSC bindings generator
+        https://bugs.webkit.org/show_bug.cgi?id=118845
+
+        Reviewed by Kentaro Hara.
+
+        Simplify IsSVGAnimatedType subroutine in the bindings generator so that
+        we no longer need to hardcode SVG animated types. Also remove the
+        CanUseFastAttribute subroutine as it is equivalent to IsSVGAnimatedType.
+        This allows us to simplify the GetterExpression subroutine so that
+        we can use fastHasAttribute() unconditionally for boolean type.
+
+        No new tests, no behavior change.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (IsSVGAnimatedType):
+        (GetterExpression):
+
+2013-07-18  Christophe Dumez  <[email protected]>
+
         Use [ImplementedAs] instead of special casing in the bindings generators
         https://bugs.webkit.org/show_bug.cgi?id=118848
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (152844 => 152845)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2013-07-18 14:24:52 UTC (rev 152844)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2013-07-18 14:51:53 UTC (rev 152845)
@@ -66,14 +66,6 @@
 
 my %nonPointerTypeHash = ("DOMTimeStamp" => 1, "CompareHow" => 1);
 
-my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1,
-                           "SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" => 1,
-                           "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1,
-                           "SVGAnimatedNumber" => 1, "SVGAnimatedNumberList" => 1,
-                           "SVGAnimatedPreserveAspectRatio" => 1,
-                           "SVGAnimatedRect" => 1, "SVGAnimatedString" => 1,
-                           "SVGAnimatedTransformList" => 1);
-
 my %svgAttributesInHTMLHash = ("class" => 1, "id" => 1, "onabort" => 1, "onclick" => 1,
                                "onerror" => 1, "onload" => 1, "onmousedown" => 1,
                                "onmouseenter" => 1, "onmouseleave" => 1,
@@ -430,8 +422,7 @@
     my $object = shift;
     my $type = shift;
 
-    return 1 if $svgAnimatedTypeHash{$type};
-    return 0;
+    return $type =~ /^SVGAnimated/;
 }
 
 sub GetSequenceType
@@ -548,16 +539,6 @@
     return "WebCore::${namespace}::${contentAttributeName}Attr";
 }
 
-sub CanUseFastAttribute
-{
-    my ($generator, $attribute) = @_;
-    my $attributeType = $attribute->signature->type;
-    # HTMLNames::styleAttr cannot be used with fast{Get,Has}Attribute but we do not [Reflect] the
-    # style attribute.
-
-    return !$generator->IsSVGAnimatedType($attributeType);
-}
-
 sub GetterExpression
 {
     my ($generator, $implIncludes, $interfaceName, $attribute) = @_;
@@ -573,11 +554,7 @@
         $functionName = "getURLAttribute";
     } elsif ($attribute->signature->type eq "boolean") {
         my $namespace = $generator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
-        if ($generator->CanUseFastAttribute($attribute)) {
-            $functionName = "fastHasAttribute";
-        } else {
-            $functionName = "hasAttribute";
-        }
+        $functionName = "hasAttribute";
     } elsif ($attribute->signature->type eq "long") {
         $functionName = "getIntegralAttribute";
     } elsif ($attribute->signature->type eq "unsigned long") {
@@ -589,10 +566,10 @@
         } elsif ($contentAttributeName eq "WebCore::HTMLNames::nameAttr") {
             $functionName = "getNameAttribute";
             $contentAttributeName = "";
-        } elsif ($generator->CanUseFastAttribute($attribute)) {
-            $functionName = "fastGetAttribute";
-        } else {
+        } elsif ($generator->IsSVGAnimatedType($attribute)) {
             $functionName = "getAttribute";
+        } else {
+            $functionName = "fastGetAttribute";
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to