Diff
Modified: trunk/LayoutTests/ChangeLog (88636 => 88637)
--- trunk/LayoutTests/ChangeLog 2011-06-13 14:12:45 UTC (rev 88636)
+++ trunk/LayoutTests/ChangeLog 2011-06-13 14:28:31 UTC (rev 88637)
@@ -1,3 +1,27 @@
+2011-06-13 Dirk Schulze <[email protected]>
+
+ Reviewed by Rob Buis.
+
+ SVG patternTransform not animatable
+ https://bugs.webkit.org/show_bug.cgi?id=62538
+
+ Test SVG animateTransform for attributes 'transform' and 'patternTransform'.
+
+ * svg/animations/animateTransform-pattern-transform-expected.txt: Added.
+ * svg/animations/animateTransform-pattern-transform.html: Added.
+ * svg/animations/animateTransform-transformable-transform-expected.txt: Added.
+ * svg/animations/animateTransform-transformable-transform.html: Added.
+ * svg/animations/script-tests/animateTransform-pattern-transform.js: Added.
+ (sample1):
+ (sample2):
+ (sample3):
+ (executeTest):
+ * svg/animations/script-tests/animateTransform-transformable-transform.js: Added.
+ (sample1):
+ (sample2):
+ (sample3):
+ (executeTest):
+
2011-06-13 Vitaly Repeshko <[email protected]>
Unreviewed.
Added: trunk/LayoutTests/svg/animations/animateTransform-pattern-transform-expected.txt (0 => 88637)
--- trunk/LayoutTests/svg/animations/animateTransform-pattern-transform-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/animations/animateTransform-pattern-transform-expected.txt 2011-06-13 14:28:31 UTC (rev 88637)
@@ -0,0 +1,19 @@
+SVG 1.1 dynamic animation tests
+
+Tests animation of 'patternTransform'. Should result in a 100x100 rect and only PASS messages.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS pattern.patternTransform.animVal.getItem(0).matrix.a is 1
+PASS pattern.patternTransform.baseVal.getItem(0).matrix.a is 1
+PASS pattern.patternTransform.animVal.getItem(0).matrix.a is 1.5
+PASS pattern.patternTransform.baseVal.getItem(0).matrix.a is 1.5
+PASS pattern.patternTransform.animVal.getItem(0).matrix.a is 2
+PASS pattern.patternTransform.baseVal.getItem(0).matrix.a is 2
+PASS pattern.patternTransform.animVal.getItem(0).matrix.a is 1
+PASS pattern.patternTransform.baseVal.getItem(0).matrix.a is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/svg/animations/animateTransform-pattern-transform.html (0 => 88637)
--- trunk/LayoutTests/svg/animations/animateTransform-pattern-transform.html (rev 0)
+++ trunk/LayoutTests/svg/animations/animateTransform-pattern-transform.html 2011-06-13 14:28:31 UTC (rev 88637)
@@ -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/animateTransform-transformable-transform-expected.txt (0 => 88637)
--- trunk/LayoutTests/svg/animations/animateTransform-transformable-transform-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/animations/animateTransform-transformable-transform-expected.txt 2011-06-13 14:28:31 UTC (rev 88637)
@@ -0,0 +1,17 @@
+SVG 1.1 dynamic animation tests
+
+Tests animation of 'transform'. Should result in a 200x200 rect and only PASS messages.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rect.transform.animVal.getItem(0).matrix.a is 1
+PASS rect.transform.baseVal.getItem(0).matrix.a is 1
+PASS rect.transform.animVal.getItem(0).matrix.a is 1.5
+PASS rect.transform.baseVal.getItem(0).matrix.a is 1.5
+PASS rect.transform.animVal.getItem(0).matrix.a is 2
+PASS rect.transform.baseVal.getItem(0).matrix.a is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/svg/animations/animateTransform-transformable-transform.html (0 => 88637)
--- trunk/LayoutTests/svg/animations/animateTransform-transformable-transform.html (rev 0)
+++ trunk/LayoutTests/svg/animations/animateTransform-transformable-transform.html 2011-06-13 14:28:31 UTC (rev 88637)
@@ -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/animateTransform-pattern-transform.js (0 => 88637)
--- trunk/LayoutTests/svg/animations/script-tests/animateTransform-pattern-transform.js (rev 0)
+++ trunk/LayoutTests/svg/animations/script-tests/animateTransform-pattern-transform.js 2011-06-13 14:28:31 UTC (rev 88637)
@@ -0,0 +1,73 @@
+description("Tests animation of 'patternTransform'. Should result in a 100x100 rect and only PASS messages.");
+createSVGTestCase();
+
+// Setup test document
+
+var defs = createSVGElement("defs");
+rootSVGElement.appendChild(defs);
+
+var pattern = createSVGElement("pattern");
+pattern.setAttribute("id", "pattern");
+pattern.setAttribute("width", "200");
+pattern.setAttribute("height", "200");
+
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("width", "200");
+rect.setAttribute("height", "200");
+rect.setAttribute("fill", "url(#pattern)");
+rect.setAttribute("onclick", "executeTest()");
+
+var patternRect = createSVGElement("rect");
+patternRect.setAttribute("id", "patternRect");
+patternRect.setAttribute("width", "100");
+patternRect.setAttribute("height", "100");
+patternRect.setAttribute("fill", "green");
+pattern.appendChild(patternRect);
+
+var animate = createSVGElement("animateTransform");
+animate.setAttribute("id", "animation");
+animate.setAttribute("attributeName", "patternTransform");
+animate.setAttribute("type", "scale");
+animate.setAttribute("from", "1");
+animate.setAttribute("to", "2");
+animate.setAttribute("begin", "rect.click");
+animate.setAttribute("dur", "4s");
+pattern.appendChild(animate);
+defs.appendChild(pattern);
+
+rootSVGElement.appendChild(rect);
+
+// Setup animation test
+function sample1() {
+ // Check initial/end conditions
+ shouldBe("pattern.patternTransform.animVal.getItem(0).matrix.a", "1");
+ shouldBe("pattern.patternTransform.baseVal.getItem(0).matrix.a", "1");
+}
+
+function sample2() {
+ // Check half-time conditions
+ shouldBe("pattern.patternTransform.animVal.getItem(0).matrix.a", "1.5");
+ shouldBe("pattern.patternTransform.baseVal.getItem(0).matrix.a", "1.5");
+}
+
+function sample3() {
+ shouldBeCloseEnough("pattern.patternTransform.animVal.getItem(0).matrix.a", "2", 0.01);
+ shouldBeCloseEnough("pattern.patternTransform.baseVal.getItem(0).matrix.a", "2", 0.01);
+}
+
+function executeTest() {
+ const expectedValues = [
+ // [animationId, time, elementId, sampleCallback]
+ ["animation", 0, "pattern", sample1],
+ ["animation", 2.0, "pattern", sample2],
+ ["animation", 3.9999, "pattern", sample3],
+ ["animation", 4, "pattern", sample1]
+ ];
+
+ runAnimationTest(expectedValues);
+}
+
+// Begin test async
+window.setTimeout("triggerUpdate(15, 30)", 0);
+var successfullyParsed = true;
Added: trunk/LayoutTests/svg/animations/script-tests/animateTransform-transformable-transform.js (0 => 88637)
--- trunk/LayoutTests/svg/animations/script-tests/animateTransform-transformable-transform.js (rev 0)
+++ trunk/LayoutTests/svg/animations/script-tests/animateTransform-transformable-transform.js 2011-06-13 14:28:31 UTC (rev 88637)
@@ -0,0 +1,54 @@
+description("Tests animation of 'transform'. Should result in a 200x200 rect and only PASS messages.");
+createSVGTestCase();
+
+// Setup test document
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("width", "200");
+rect.setAttribute("height", "200");
+rect.setAttribute("fill", "green");
+rect.setAttribute("onclick", "executeTest()");
+
+var animate = createSVGElement("animateTransform");
+animate.setAttribute("id", "animation");
+animate.setAttribute("attributeName", "transform");
+animate.setAttribute("type", "scale");
+animate.setAttribute("from", "1");
+animate.setAttribute("to", "2");
+animate.setAttribute("begin", "click");
+animate.setAttribute("dur", "4s");
+rect.appendChild(animate);
+rootSVGElement.appendChild(rect);
+
+// Setup animation test
+function sample1() {
+ // Check initial/end conditions
+ shouldBeCloseEnough("rect.transform.animVal.getItem(0).matrix.a", "1", 0.01);
+ shouldBeCloseEnough("rect.transform.baseVal.getItem(0).matrix.a", "1", 0.01);
+}
+
+function sample2() {
+ // Check half-time conditions
+ shouldBe("rect.transform.animVal.getItem(0).matrix.a", "1.5");
+ shouldBe("rect.transform.baseVal.getItem(0).matrix.a", "1.5");
+}
+
+function sample3() {
+ shouldBeCloseEnough("rect.transform.animVal.getItem(0).matrix.a", "2", 0.01);
+ shouldBeCloseEnough("rect.transform.baseVal.getItem(0).matrix.a", "2", 0.01);
+}
+
+function executeTest() {
+ const expectedValues = [
+ // [animationId, time, elementId, sampleCallback]
+ ["animation", 0.001, "rect", sample1],
+ ["animation", 2.0, "rect", sample2],
+ ["animation", 3.9999, "rect", sample3],
+ ];
+
+ runAnimationTest(expectedValues);
+}
+
+// Begin test async
+window.setTimeout("triggerUpdate(15, 30)", 0);
+var successfullyParsed = true;
Modified: trunk/Source/WebCore/ChangeLog (88636 => 88637)
--- trunk/Source/WebCore/ChangeLog 2011-06-13 14:12:45 UTC (rev 88636)
+++ trunk/Source/WebCore/ChangeLog 2011-06-13 14:28:31 UTC (rev 88637)
@@ -1,3 +1,21 @@
+2011-06-13 Dirk Schulze <[email protected]>
+
+ Reviewed by Rob Buis.
+
+ SVG patternTransform not animatable
+ https://bugs.webkit.org/show_bug.cgi?id=62538
+
+ SVG animation did not take attribute 'patternTransform' into account. Added support for combination of
+ SVGPatternElement and attribute 'patternTransform' to SVGAnimateTransformElement.
+
+ Tests: svg/animations/animateTransform-pattern-transform.html
+ svg/animations/animateTransform-transformable-transform.html
+
+ * svg/SVGAnimateTransformElement.cpp:
+ (WebCore::transformListFor):
+ (WebCore::SVGAnimateTransformElement::resetToBaseValue):
+ (WebCore::SVGAnimateTransformElement::applyResultsToTarget):
+
2011-06-13 Caio Marcelo de Oliveira Filho <[email protected]>
Reviewed by Andreas Kling.
Modified: trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp (88636 => 88637)
--- trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp 2011-06-13 14:12:45 UTC (rev 88636)
+++ trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp 2011-06-13 14:28:31 UTC (rev 88637)
@@ -34,13 +34,13 @@
#include "SVGGradientElement.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
+#include "SVGPatternElement.h"
#include "SVGSVGElement.h"
#include "SVGStyledTransformableElement.h"
#include "SVGTextElement.h"
#include "SVGTransform.h"
#include "SVGTransformList.h"
#include "SVGUseElement.h"
-#include <math.h>
#include <wtf/MathExtras.h>
using namespace std;
@@ -123,7 +123,8 @@
return &static_cast<SVGTextElement*>(element)->transform();
if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTagName(SVGNames::radialGradientTag))
return &static_cast<SVGGradientElement*>(element)->gradientTransform();
- // FIXME: Handle patternTransform, which is obviously missing!
+ if (element->hasTagName(SVGNames::patternTag))
+ return &static_cast<SVGPatternElement*>(element)->patternTransform();
return 0;
}
@@ -133,11 +134,16 @@
if (!targetElement || determineAnimatedAttributeType(targetElement) == AnimatedUnknown)
return;
+ // FIXME: This might not be correct for accumulated sum. Needs checking.
if (targetElement->hasTagName(SVGNames::linearGradientTag) || targetElement->hasTagName(SVGNames::radialGradientTag)) {
targetElement->setAttribute(SVGNames::gradientTransformAttr, baseValue.isEmpty() ? "matrix(1 0 0 1 0 0)" : baseValue);
return;
}
-
+ if (targetElement->hasTagName(SVGNames::patternTag)) {
+ targetElement->setAttribute(SVGNames::patternTransformAttr, baseValue.isEmpty() ? "matrix(1 0 0 1 0 0)" : baseValue);
+ return;
+ }
+
if (baseValue.isEmpty()) {
if (SVGTransformList* list = transformListFor(targetElement))
list->clear();
@@ -221,7 +227,8 @@
static_cast<SVGTextElement*>(shadowTreeElement)->setTransformBaseValue(*transformList);
else if (shadowTreeElement->hasTagName(SVGNames::linearGradientTag) || shadowTreeElement->hasTagName(SVGNames::radialGradientTag))
static_cast<SVGGradientElement*>(shadowTreeElement)->setGradientTransformBaseValue(*transformList);
- // FIXME: Handle patternTransform, obviously missing!
+ else if (shadowTreeElement->hasTagName(SVGNames::patternTag))
+ static_cast<SVGPatternElement*>(shadowTreeElement)->setPatternTransformBaseValue(*transformList);
if (RenderObject* renderer = shadowTreeElement->renderer()) {
renderer->setNeedsTransformUpdate();
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);