Diff
Modified: trunk/LayoutTests/ChangeLog (87391 => 87392)
--- trunk/LayoutTests/ChangeLog 2011-05-26 16:08:43 UTC (rev 87391)
+++ trunk/LayoutTests/ChangeLog 2011-05-26 16:13:10 UTC (rev 87392)
@@ -1,3 +1,25 @@
+2011-05-26 Rob Buis <[email protected]>
+
+ Reviewed by Dirk Schulze.
+
+ Dynamically created <animate> elements do not animate upon document insertion as they should
+ https://bugs.webkit.org/show_bug.cgi?id=20028
+
+ Add tests for dynamically inserting <animate>.
+
+ * svg/animations/animate-insert-begin-expected.txt: Added.
+ * svg/animations/animate-insert-begin.html: Added.
+ * svg/animations/animate-insert-no-begin-expected.txt: Added.
+ * svg/animations/animate-insert-no-begin.html: Added.
+ * svg/animations/script-tests/animate-insert-begin.js: Added.
+ (sample1):
+ (sample2):
+ (executeTest):
+ * svg/animations/script-tests/animate-insert-no-begin.js: Added.
+ (sample1):
+ (sample2):
+ (executeTest):
+
2011-05-26 Chang Shu <[email protected]>
Unreviewed.
Added: trunk/LayoutTests/svg/animations/animate-insert-begin-expected.txt (0 => 87392)
--- trunk/LayoutTests/svg/animations/animate-insert-begin-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-insert-begin-expected.txt 2011-05-26 16:13:10 UTC (rev 87392)
@@ -0,0 +1,13 @@
+SVG 1.1 dynamic animation tests
+
+Test behavior of dynamically inserting animate with begin attribute
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rect.x.baseVal.value is 0
+PASS rect.x.baseVal.value is 90
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/svg/animations/animate-insert-begin.html (0 => 87392)
--- trunk/LayoutTests/svg/animations/animate-insert-begin.html (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-insert-begin.html 2011-05-26 16:13:10 UTC (rev 87392)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/svg/animations/animate-insert-no-begin-expected.txt (0 => 87392)
--- trunk/LayoutTests/svg/animations/animate-insert-no-begin-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-insert-no-begin-expected.txt 2011-05-26 16:13:10 UTC (rev 87392)
@@ -0,0 +1,13 @@
+SVG 1.1 dynamic animation tests
+
+Test behavior of dynamically inserting animate without begin attribute
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rect.x.baseVal.value is 0
+PASS rect.x.baseVal.value is 90
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/svg/animations/animate-insert-no-begin.html (0 => 87392)
--- trunk/LayoutTests/svg/animations/animate-insert-no-begin.html (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-insert-no-begin.html 2011-05-26 16:13:10 UTC (rev 87392)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/svg/animations/script-tests/animate-insert-begin.js (0 => 87392)
--- trunk/LayoutTests/svg/animations/script-tests/animate-insert-begin.js (rev 0)
+++ trunk/LayoutTests/svg/animations/script-tests/animate-insert-begin.js 2011-05-26 16:13:10 UTC (rev 87392)
@@ -0,0 +1,47 @@
+description("Test behavior of dynamically inserting animate with begin attribute");
+createSVGTestCase();
+
+
+// Setup test document
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("x", "0");
+rect.setAttribute("y", "45");
+rect.setAttribute("width", "10");
+rect.setAttribute("height", "10");
+rect.setAttribute("fill", "green");
+rect.setAttribute("onclick", "executeTest()");
+
+var animate = createSVGElement("animate");
+animate.setAttribute("id", "animation");
+animate.setAttribute("attributeName", "x");
+animate.setAttribute("begin", "0");
+animate.setAttribute("from", "0");
+animate.setAttribute("to", "90");
+animate.setAttribute("dur", "3s");
+animate.setAttribute("fill", "freeze");
+rect.appendChild(animate);
+rootSVGElement.appendChild(rect);
+
+// Setup animation test
+function sample1() {
+ shouldBe("rect.x.baseVal.value", "0");
+}
+
+function sample2() {
+ shouldBe("rect.x.baseVal.value", "90");
+}
+
+function executeTest() {
+ const expectedValues = [
+ // [animationId, time, elementId, sampleCallback]
+ ["animation", 0.0, "rect", sample1],
+ ["animation", 3.0, "rect", sample2],
+ ];
+
+ runAnimationTest(expectedValues);
+}
+
+// Begin test async
+window.setTimeout("triggerUpdate(5, 50)", 0);
+var successfullyParsed = true;
Added: trunk/LayoutTests/svg/animations/script-tests/animate-insert-no-begin.js (0 => 87392)
--- trunk/LayoutTests/svg/animations/script-tests/animate-insert-no-begin.js (rev 0)
+++ trunk/LayoutTests/svg/animations/script-tests/animate-insert-no-begin.js 2011-05-26 16:13:10 UTC (rev 87392)
@@ -0,0 +1,46 @@
+description("Test behavior of dynamically inserting animate without begin attribute");
+createSVGTestCase();
+
+
+// Setup test document
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("x", "0");
+rect.setAttribute("y", "45");
+rect.setAttribute("width", "10");
+rect.setAttribute("height", "10");
+rect.setAttribute("fill", "green");
+rect.setAttribute("onclick", "executeTest()");
+
+var animate = createSVGElement("animate");
+animate.setAttribute("id", "animation");
+animate.setAttribute("attributeName", "x");
+animate.setAttribute("from", "0");
+animate.setAttribute("to", "90");
+animate.setAttribute("dur", "3s");
+animate.setAttribute("fill", "freeze");
+rect.appendChild(animate);
+rootSVGElement.appendChild(rect);
+
+// Setup animation test
+function sample1() {
+ shouldBe("rect.x.baseVal.value", "0");
+}
+
+function sample2() {
+ shouldBe("rect.x.baseVal.value", "90");
+}
+
+function executeTest() {
+ const expectedValues = [
+ // [animationId, time, elementId, sampleCallback]
+ ["animation", 0.0, "rect", sample1],
+ ["animation", 3.0, "rect", sample2],
+ ];
+
+ runAnimationTest(expectedValues);
+}
+
+// Begin test async
+window.setTimeout("triggerUpdate(5, 50)", 0);
+var successfullyParsed = true;
Modified: trunk/Source/WebCore/ChangeLog (87391 => 87392)
--- trunk/Source/WebCore/ChangeLog 2011-05-26 16:08:43 UTC (rev 87391)
+++ trunk/Source/WebCore/ChangeLog 2011-05-26 16:13:10 UTC (rev 87392)
@@ -1,3 +1,20 @@
+2011-05-26 Rob Buis <[email protected]>
+
+ Reviewed by Dirk Schulze.
+
+ Dynamically created <animate> elements do not animate upon document insertion as they should
+ https://bugs.webkit.org/show_bug.cgi?id=20028
+
+ Tests: svg/animations/animate-insert-begin.html
+ svg/animations/animate-insert-no-begin.html
+
+ Move animation initializing and rescheduling to insertedIntoDocument. This way animate elements
+ dynamicaly inserted into the document using js start as well.
+
+ * svg/animation/SVGSMILElement.cpp:
+ (WebCore::SVGSMILElement::insertedIntoDocument):
+ * svg/animation/SVGSMILElement.h:
+
2011-05-26 Andreas Kling <[email protected]>
Reviewed by Benjamin Poulain.
Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (87391 => 87392)
--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2011-05-26 16:08:43 UTC (rev 87391)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2011-05-26 16:13:10 UTC (rev 87392)
@@ -182,7 +182,15 @@
m_timeContainer = owner->timeContainer();
ASSERT(m_timeContainer);
m_timeContainer->setDocumentOrderIndexesDirty();
- reschedule();
+
+ // "If no attribute is present, the default begin value (an offset-value of 0) must be evaluated."
+ if (!hasAttribute(SVGNames::beginAttr))
+ m_beginTimes.append(0);
+
+ if (m_isWaitingForFirstInterval) {
+ resolveFirstInterval();
+ reschedule();
+ }
}
void SVGSMILElement::removedFromDocument()
@@ -203,20 +211,6 @@
SVGElement::removedFromDocument();
}
-void SVGSMILElement::finishParsingChildren()
-{
- SVGElement::finishParsingChildren();
-
- // "If no attribute is present, the default begin value (an offset-value of 0) must be evaluated."
- if (!hasAttribute(SVGNames::beginAttr))
- m_beginTimes.append(0);
-
- if (m_isWaitingForFirstInterval) {
- resolveFirstInterval();
- reschedule();
- }
-}
-
SMILTime SVGSMILElement::parseOffsetValue(const String& data)
{
bool ok;
Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.h (87391 => 87392)
--- trunk/Source/WebCore/svg/animation/SVGSMILElement.h 2011-05-26 16:08:43 UTC (rev 87391)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.h 2011-05-26 16:13:10 UTC (rev 87392)
@@ -48,7 +48,6 @@
virtual void attributeChanged(Attribute*, bool preserveDecls);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
- virtual void finishParsingChildren();
virtual bool hasValidAttributeType() const = 0;