Title: [125608] trunk
Revision
125608
Author
[email protected]
Date
2012-08-14 14:33:56 -0700 (Tue, 14 Aug 2012)

Log Message

beginElement() does not observe updated animation attributes
https://bugs.webkit.org/show_bug.cgi?id=93972

Reviewed by Dirk Schulze.

Source/WebCore:

The SVG animation attributes 'from', 'to' and 'by' should be registered as supported
SVGSMILElement attributes in order to trigger animationAttributeChanged() on dynamic
updates.

Test: svg/animations/updated-attributes.html

* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::updateAnimation):
Minor optimization - avoid recalculating animationMode().

* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::isSupportedAttribute):
Register 'from', 'to' and 'by' as supported SVGSMILElement attributes.

LayoutTests:

* svg/animations/updated-attributes-expected.txt: Added.
* svg/animations/updated-attributes.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125607 => 125608)


--- trunk/LayoutTests/ChangeLog	2012-08-14 21:33:21 UTC (rev 125607)
+++ trunk/LayoutTests/ChangeLog	2012-08-14 21:33:56 UTC (rev 125608)
@@ -1,3 +1,13 @@
+2012-08-14  Florin Malita  <[email protected]>
+
+        beginElement() does not observe updated animation attributes
+        https://bugs.webkit.org/show_bug.cgi?id=93972
+
+        Reviewed by Dirk Schulze.
+
+        * svg/animations/updated-attributes-expected.txt: Added.
+        * svg/animations/updated-attributes.html: Added.
+
 2012-08-14  Roger Fong  <[email protected]>
 
         Rebaseline fast/box-sizing/box-sizing.html and compositing/overflow/clip-descendents.html.

Added: trunk/LayoutTests/svg/animations/updated-attributes-expected.txt (0 => 125608)


--- trunk/LayoutTests/svg/animations/updated-attributes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/updated-attributes-expected.txt	2012-08-14 21:33:56 UTC (rev 125608)
@@ -0,0 +1,2 @@
+PASS: animated width is 100
+

Added: trunk/LayoutTests/svg/animations/updated-attributes.html (0 => 125608)


--- trunk/LayoutTests/svg/animations/updated-attributes.html	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/updated-attributes.html	2012-08-14 21:33:56 UTC (rev 125608)
@@ -0,0 +1,36 @@
+<html>
+<body>
+  <!-- Test for https://bugs.webkit.org/show_bug.cgi?id=93972 -->
+  <div id="result"></div>
+
+  <svg xmlns="http://www.w3.org/2000/svg">
+    <rect id="rect" height="100" fill="green">
+      <animate id="animation" attributeName="width" from="10" to="100" begin="0s" dur="indefinite" fill="freeze" />
+    </rect>
+  </svg>
+
+<script>
+  if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+  }
+
+  function check() {
+    var width = document.getElementById('rect').width.animVal.value;
+    document.getElementById('result').innerHTML = (width == 100 ? "PASS: " : "FAIL: ") + 'animated width is ' + width;
+
+    if (window.testRunner)
+      testRunner.notifyDone();
+  }
+
+  window.setTimeout(function() {
+    var ani = document.getElementById('animation');
+    ani.setAttribute("from", "100");
+    ani.beginElement();
+
+    window.setTimeout(function() { check(); }, 0);
+  }, 0);
+</script>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (125607 => 125608)


--- trunk/Source/WebCore/ChangeLog	2012-08-14 21:33:21 UTC (rev 125607)
+++ trunk/Source/WebCore/ChangeLog	2012-08-14 21:33:56 UTC (rev 125608)
@@ -1,3 +1,24 @@
+2012-08-14  Florin Malita  <[email protected]>
+
+        beginElement() does not observe updated animation attributes
+        https://bugs.webkit.org/show_bug.cgi?id=93972
+
+        Reviewed by Dirk Schulze.
+
+        The SVG animation attributes 'from', 'to' and 'by' should be registered as supported
+        SVGSMILElement attributes in order to trigger animationAttributeChanged() on dynamic
+        updates.
+
+        Test: svg/animations/updated-attributes.html
+
+        * svg/SVGAnimationElement.cpp:
+        (WebCore::SVGAnimationElement::updateAnimation):
+        Minor optimization - avoid recalculating animationMode().
+
+        * svg/animation/SVGSMILElement.cpp:
+        (WebCore::SVGSMILElement::isSupportedAttribute):
+        Register 'from', 'to' and 'by' as supported SVGSMILElement attributes.
+
 2012-08-14  Filip Spacek  <[email protected]>
 
         [BlackBerry] Don't crash on OOM in AC

Modified: trunk/Source/WebCore/svg/SVGAnimationElement.cpp (125607 => 125608)


--- trunk/Source/WebCore/svg/SVGAnimationElement.cpp	2012-08-14 21:33:21 UTC (rev 125607)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.cpp	2012-08-14 21:33:56 UTC (rev 125608)
@@ -574,8 +574,9 @@
         return;
 
     float effectivePercent;
-    CalcMode mode = calcMode();
-    if (animationMode() == ValuesAnimation) {
+    CalcMode calcMode = this->calcMode();
+    AnimationMode animationMode = this->animationMode();
+    if (animationMode == ValuesAnimation) {
         String from;
         String to;
         currentValuesForValuesAnimation(percent, effectivePercent, from, to);
@@ -586,11 +587,11 @@
             m_lastValuesAnimationFrom = from;
             m_lastValuesAnimationTo = to;
         }
-    } else if (!m_keyPoints.isEmpty() && mode != CalcModePaced)
+    } else if (!m_keyPoints.isEmpty() && calcMode != CalcModePaced)
         effectivePercent = calculatePercentFromKeyPoints(percent);
-    else if (m_keyPoints.isEmpty() && mode == CalcModeSpline && m_keyTimes.size() > 1)
+    else if (m_keyPoints.isEmpty() && calcMode == CalcModeSpline && m_keyTimes.size() > 1)
         effectivePercent = calculatePercentForSpline(percent, calculateKeyTimesIndex(percent));
-    else if (animationMode() == FromToAnimation || animationMode() == ToAnimation)
+    else if (animationMode == FromToAnimation || animationMode == ToAnimation)
         effectivePercent = calculatePercentForFromTo(percent);
     else
         effectivePercent = percent;

Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (125607 => 125608)


--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp	2012-08-14 21:33:21 UTC (rev 125607)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp	2012-08-14 21:33:56 UTC (rev 125608)
@@ -410,6 +410,9 @@
         supportedAttributes.add(SVGNames::minAttr);
         supportedAttributes.add(SVGNames::maxAttr);
         supportedAttributes.add(SVGNames::attributeNameAttr);
+        supportedAttributes.add(SVGNames::fromAttr);
+        supportedAttributes.add(SVGNames::toAttr);
+        supportedAttributes.add(SVGNames::byAttr);
         supportedAttributes.add(XLinkNames::hrefAttr);
     }
     return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to