Title: [138296] trunk/Source/WebCore
Revision
138296
Author
a...@chromium.org
Date
2012-12-20 13:40:14 -0800 (Thu, 20 Dec 2012)

Log Message

fastAttributeLookupAllowed: classAttr is only animatable by SVG styled elements
https://bugs.webkit.org/show_bug.cgi?id=105565

Reviewed by Eric Seidel.

When it comes to determining if we can use fastGetAttribute we should not penalize
all classAttr access just because some SVG styled elements does funky things with
className.

This makes classAttr considered animatable only for styled SVG elements.

No new tests. No change in behavior.

* bindings/scripts/CodeGenerator.pm:
* dom/Element.cpp:
* svg/SVGElement.cpp:
* svg/SVGElement.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138295 => 138296)


--- trunk/Source/WebCore/ChangeLog	2012-12-20 21:38:30 UTC (rev 138295)
+++ trunk/Source/WebCore/ChangeLog	2012-12-20 21:40:14 UTC (rev 138296)
@@ -1,3 +1,23 @@
+2012-12-20  Erik Arvidsson  <a...@chromium.org>
+
+        fastAttributeLookupAllowed: classAttr is only animatable by SVG styled elements
+        https://bugs.webkit.org/show_bug.cgi?id=105565
+
+        Reviewed by Eric Seidel.
+
+        When it comes to determining if we can use fastGetAttribute we should not penalize
+        all classAttr access just because some SVG styled elements does funky things with
+        className.
+
+        This makes classAttr considered animatable only for styled SVG elements.
+
+        No new tests. No change in behavior.
+
+        * bindings/scripts/CodeGenerator.pm:
+        * dom/Element.cpp:
+        * svg/SVGElement.cpp:
+        * svg/SVGElement.h:
+
 2012-12-20  Huang Dongsung  <luxte...@company100.net>
 
         [TexMap] Remove ParentChange in TextureMapperLayer.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (138295 => 138296)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2012-12-20 21:38:30 UTC (rev 138295)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2012-12-20 21:40:14 UTC (rev 138296)
@@ -567,14 +567,11 @@
 
 sub CanUseFastAttribute
 {
-    my ($generator, $attribute, $contentAttributeName) = @_;
+    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.
 
-    # Unfortunately SVG makes class animatable.
-    return 0 if $contentAttributeName eq "WebCore::HTMLNames::classAttr";
-
     return !$generator->IsSVGAnimatedType($attributeType);
 }
 
@@ -593,7 +590,7 @@
         $functionName = "getURLAttribute";
     } elsif ($attribute->signature->type eq "boolean") {
         my $namespace = $generator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
-        if ($generator->CanUseFastAttribute($attribute, $contentAttributeName)) {
+        if ($generator->CanUseFastAttribute($attribute)) {
             $functionName = "fastHasAttribute";
         } else {
             $functionName = "hasAttribute";
@@ -603,7 +600,7 @@
     } elsif ($attribute->signature->type eq "unsigned long") {
         $functionName = "getUnsignedIntegralAttribute";
     } else {
-        if ($generator->CanUseFastAttribute($attribute, $contentAttributeName)) {
+        if ($generator->CanUseFastAttribute($attribute)) {
             $functionName = "fastGetAttribute";
         } else {
             $functionName = "getAttribute";

Modified: trunk/Source/WebCore/dom/Element.cpp (138295 => 138296)


--- trunk/Source/WebCore/dom/Element.cpp	2012-12-20 21:38:30 UTC (rev 138295)
+++ trunk/Source/WebCore/dom/Element.cpp	2012-12-20 21:40:14 UTC (rev 138296)
@@ -2443,7 +2443,7 @@
 
 #if ENABLE(SVG)
     if (isSVGElement())
-        return !SVGElement::isAnimatableAttribute(name);
+        return !static_cast<const SVGElement*>(this)->isAnimatableAttribute(name);
 #endif
 
     return true;

Modified: trunk/Source/WebCore/svg/SVGElement.cpp (138295 => 138296)


--- trunk/Source/WebCore/svg/SVGElement.cpp	2012-12-20 21:38:30 UTC (rev 138295)
+++ trunk/Source/WebCore/svg/SVGElement.cpp	2012-12-20 21:40:14 UTC (rev 138296)
@@ -646,12 +646,11 @@
 }
 
 #ifndef NDEBUG
-bool SVGElement::isAnimatableAttribute(const QualifiedName& name)
+bool SVGElement::isAnimatableAttribute(const QualifiedName& name) const
 {
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, animatableAttributes, ());
 
     if (animatableAttributes.isEmpty()) {
-        animatableAttributes.add(classAttr);
         animatableAttributes.add(XLinkNames::hrefAttr);
         animatableAttributes.add(SVGNames::amplitudeAttr);
         animatableAttributes.add(SVGNames::azimuthAttr);
@@ -746,6 +745,10 @@
         animatableAttributes.add(SVGNames::yChannelSelectorAttr);
         animatableAttributes.add(SVGNames::zAttr);
     }
+
+    if (name == classAttr)
+        return isStyled();
+
     return animatableAttributes.contains(name);
 }
 #endif

Modified: trunk/Source/WebCore/svg/SVGElement.h (138295 => 138296)


--- trunk/Source/WebCore/svg/SVGElement.h	2012-12-20 21:38:30 UTC (rev 138295)
+++ trunk/Source/WebCore/svg/SVGElement.h	2012-12-20 21:40:14 UTC (rev 138296)
@@ -113,7 +113,7 @@
     virtual SVGAttributeToPropertyMap& localAttributeToPropertyMap();
 
 #ifndef NDEBUG
-    static bool isAnimatableAttribute(const QualifiedName&);
+    bool isAnimatableAttribute(const QualifiedName&) const;
 #endif
 
     StylePropertySet* animatedSMILStyleProperties() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to