[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

krit at webkit.org krit at webkit.org
Sun Feb 20 23:48:26 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 3ca490b2ccdc9c1f6ce103f516425a787a534181
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 25 13:46:18 2011 +0000

    2011-01-25  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG is missing to-animation support for Path
            https://bugs.webkit.org/show_bug.cgi?id=52982
    
            Added an animation test to check 'to' animations in combination with SVG paths.
    
            * svg/animations/animate-path-to-animation-expected.txt: Added.
            * svg/animations/animate-path-to-animation.html: Added.
            * svg/animations/script-tests/animate-path-to-animation.js: Added.
            (sample1):
            (sample2):
            (sample3):
            (executeTest):
    2011-01-25  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG is missing to-animation support for Path
            https://bugs.webkit.org/show_bug.cgi?id=52982
    
            SVG was missing 'to' animation support for SVG paths. Even the fallback to discrete
            animation did not work and an assert was thrown, because of the missing m_fromPath.
            This also influences a test of the W3C test suite. Subtest 2 of animate-elem-83-t.svg passes now.
    
            Test: svg/animations/animate-path-to-animation.html
    
            * svg/SVGAnimateElement.cpp:
            (WebCore::SVGAnimateElement::calculateAnimatedValue): Take the value of the last SVGAnimateElement for
            m_fromPath, since 'to' animations are accumulative.
            (WebCore::SVGAnimateElement::calculateFromAndToValues): Added support for 'to' animations.
            (WebCore::SVGAnimateElement::resetToBaseValue): Set m_animatedPath on the first animation element to baseVal.
            * svg/SVGPathByteStream.h:
            (WebCore::SVGPathByteStream::copySVGPathByteStream): Return copy of current byte stream.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76589 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 16171a8..dd96186 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2011-01-25  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG is missing to-animation support for Path
+        https://bugs.webkit.org/show_bug.cgi?id=52982
+
+        Added an animation test to check 'to' animations in combination with SVG paths.
+
+        * svg/animations/animate-path-to-animation-expected.txt: Added.
+        * svg/animations/animate-path-to-animation.html: Added.
+        * svg/animations/script-tests/animate-path-to-animation.js: Added.
+        (sample1):
+        (sample2):
+        (sample3):
+        (executeTest):
+
 2011-01-25  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Introduce FontMetrics abstraction
diff --git a/LayoutTests/svg/animations/animate-path-to-animation-expected.txt b/LayoutTests/svg/animations/animate-path-to-animation-expected.txt
new file mode 100644
index 0000000..682b5c5
--- /dev/null
+++ b/LayoutTests/svg/animations/animate-path-to-animation-expected.txt
@@ -0,0 +1,19 @@
+SVG 1.1 dynamic animation tests
+
+Test calcMode spline with to animation. You should see a green 100x100 path and only PASS messages
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS path.pathSegList.getItem(0).x is 40
+PASS path.pathSegList.getItem(0).y is 40
+PASS path.pathSegList.getItem(0).x is almost 20, after first half
+PASS path.pathSegList.getItem(0).y is almost 20, after first half
+PASS path.pathSegList.getItem(0).x is almost 0, after first half
+PASS path.pathSegList.getItem(0).y is almost 0, after first half
+PASS path.pathSegList.getItem(0).x is 40
+PASS path.pathSegList.getItem(0).y is 40
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/animations/animate-path-to-animation.html b/LayoutTests/svg/animations/animate-path-to-animation.html
new file mode 100644
index 0000000..01f4632
--- /dev/null
+++ b/LayoutTests/svg/animations/animate-path-to-animation.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../dynamic-updates/resources/SVGTestCase.js"></script>
+<script src="resources/SVGAnimationTestCase.js"></script>
+</head>
+<body>
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/animate-path-to-animation.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/animations/script-tests/animate-path-to-animation.js b/LayoutTests/svg/animations/script-tests/animate-path-to-animation.js
new file mode 100644
index 0000000..ec2a376
--- /dev/null
+++ b/LayoutTests/svg/animations/script-tests/animate-path-to-animation.js
@@ -0,0 +1,70 @@
+description("Test calcMode spline with to animation. You should see a green 100x100 path and only PASS messages");
+createSVGTestCase();
+// FIXME: We should move to animatePathSegList, once it is implemented.
+
+// Setup test document
+var path = createSVGElement("path");
+path.setAttribute("id", "path");
+path.setAttribute("d", "M 40 40 L 60 40 L 60 60 L 40 60 z");
+path.setAttribute("fill", "green");
+path.setAttribute("onclick", "executeTest()");
+
+var animate = createSVGElement("animate");
+animate.setAttribute("id", "animation");
+animate.setAttribute("attributeName", "d");
+animate.setAttribute("to", "M 0 0 L 100 0 L 100 100 L 0 100 z");
+animate.setAttribute("begin", "click");
+animate.setAttribute("dur", "4s");
+path.appendChild(animate);
+rootSVGElement.appendChild(path);
+
+// Setup animation test
+function sample1() {
+    // Check initial/end conditions
+    shouldBe("path.pathSegList.getItem(0).x", "40");
+    shouldBe("path.pathSegList.getItem(0).y", "40");
+}
+
+function sample2() {
+    var ok = isCloseEnough(path.pathSegList.getItem(0).x, 20, 0.01);
+    if (ok)
+        testPassed("path.pathSegList.getItem(0).x is almost 20, after first half");
+    else
+        testFailed("path.pathSegList.getItem(0).x was NOT almost 20, as expected");
+
+    ok = isCloseEnough(path.pathSegList.getItem(0).y, 20, 0.01);
+    if (ok)
+        testPassed("path.pathSegList.getItem(0).y is almost 20, after first half");
+    else
+        testFailed("path.pathSegList.getItem(0).y was NOT almost 20, as expected");
+}
+
+function sample3() {
+    var ok = isCloseEnough(path.pathSegList.getItem(0).x, 0, 0.01);
+    if (ok)
+        testPassed("path.pathSegList.getItem(0).x is almost 0, after first half");
+    else
+        testFailed("path.pathSegList.getItem(0).x was NOT almost 0, as expected");
+
+    ok = isCloseEnough(path.pathSegList.getItem(0).y, 0, 0.01);
+    if (ok)
+        testPassed("path.pathSegList.getItem(0).y is almost 0, after first half");
+    else
+        testFailed("path.pathSegList.getItem(0).y was NOT almost 0, as expected");
+}
+
+function executeTest() {
+    const expectedValues = [
+        // [animationId, time, elementId, sampleCallback]
+        ["animation", 0.0,    "path", sample1],
+        ["animation", 2.0,    "path", sample2],
+        ["animation", 3.9999, "path", sample3],
+        ["animation", 4.0 ,   "path", sample1]
+    ];
+
+    runAnimationTest(expectedValues);
+}
+
+// Begin test async
+window.setTimeout("triggerUpdate(50, 50)", 0);
+var successfullyParsed = true;
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 188775c..5c6c83f 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2011-01-25  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG is missing to-animation support for Path
+        https://bugs.webkit.org/show_bug.cgi?id=52982
+
+        SVG was missing 'to' animation support for SVG paths. Even the fallback to discrete
+        animation did not work and an assert was thrown, because of the missing m_fromPath.
+        This also influences a test of the W3C test suite. Subtest 2 of animate-elem-83-t.svg passes now.
+
+        Test: svg/animations/animate-path-to-animation.html
+
+        * svg/SVGAnimateElement.cpp:
+        (WebCore::SVGAnimateElement::calculateAnimatedValue): Take the value of the last SVGAnimateElement for
+        m_fromPath, since 'to' animations are accumulative.
+        (WebCore::SVGAnimateElement::calculateFromAndToValues): Added support for 'to' animations.
+        (WebCore::SVGAnimateElement::resetToBaseValue): Set m_animatedPath on the first animation element to baseVal.
+        * svg/SVGPathByteStream.h:
+        (WebCore::SVGPathByteStream::copySVGPathByteStream): Return copy of current byte stream.
+
 2011-01-25  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/Source/WebCore/svg/SVGAnimateElement.cpp b/Source/WebCore/svg/SVGAnimateElement.cpp
index 7fe4c87..67f53e4 100644
--- a/Source/WebCore/svg/SVGAnimateElement.cpp
+++ b/Source/WebCore/svg/SVGAnimateElement.cpp
@@ -138,6 +138,10 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat
     }
     AnimationMode animationMode = this->animationMode();
     if (m_propertyType == PathProperty) {
+        if (animationMode == ToAnimation) {
+            ASSERT(results->m_animatedPathPointer);
+            m_fromPath = results->m_animatedPathPointer->copy();
+        }
         if (!percentage) {
             ASSERT(m_fromPath);
             ASSERT(percentage >= 0);
@@ -210,8 +214,9 @@ bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const
         }
     } else if (m_propertyType == PathProperty) {
         SVGPathParserFactory* factory = SVGPathParserFactory::self();
-        if (factory->buildSVGPathByteStreamFromString(fromString, m_fromPath, UnalteredParsing)) {
-            if (factory->buildSVGPathByteStreamFromString(toString, m_toPath, UnalteredParsing))
+        if (factory->buildSVGPathByteStreamFromString(toString, m_toPath, UnalteredParsing)) {
+            // For to-animations the from number is calculated later
+            if (animationMode() == ToAnimation || factory->buildSVGPathByteStreamFromString(fromString, m_fromPath, UnalteredParsing))
                 return true;
         }
         m_fromPath.clear();
@@ -272,7 +277,9 @@ void SVGAnimateElement::resetToBaseValue(const String& baseString)
             return;
     } else if (m_propertyType == PathProperty) {
         m_animatedPath.clear();
-        m_animatedPathPointer = 0;
+        SVGPathParserFactory* factory = SVGPathParserFactory::self();
+        factory->buildSVGPathByteStreamFromString(baseString, m_animatedPath, UnalteredParsing);
+        m_animatedPathPointer = m_animatedPath.get();
         return;
     } else if (m_propertyType == PointsProperty) {
         m_animatedPoints.clear();
diff --git a/Source/WebCore/svg/SVGPathByteStream.h b/Source/WebCore/svg/SVGPathByteStream.h
index a444ac0..af283f7 100644
--- a/Source/WebCore/svg/SVGPathByteStream.h
+++ b/Source/WebCore/svg/SVGPathByteStream.h
@@ -51,6 +51,11 @@ public:
         return adoptPtr(new SVGPathByteStream);
     }
 
+    PassOwnPtr<SVGPathByteStream> copy()
+    {
+        return adoptPtr(new SVGPathByteStream(m_data));
+    }
+
     typedef Vector<unsigned char> Data;
     typedef Data::const_iterator DataIterator;
 
@@ -62,6 +67,11 @@ public:
 
 private:
     SVGPathByteStream() { }
+    SVGPathByteStream(Data& data)
+        : m_data(data)
+    {
+    }
+
     Data m_data;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list