Title: [112247] trunk
Revision
112247
Author
zimmerm...@webkit.org
Date
2012-03-27 03:47:05 -0700 (Tue, 27 Mar 2012)

Log Message

Enable animVal support for SVGAnimatedRect
https://bugs.webkit.org/show_bug.cgi?id=82317

Reviewed by Zoltan Herczeg.

Source/WebCore:

Enable animVal support for SVGAnimatedRect. Very simple now that everything is prepared.
All we have to do is add startAnimValAnimation/etc. methods to SVGAnimatedRectAnimator.

Extended existing tests to cover this.

* svg/SVGAnimatedRect.cpp:
(WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedRectAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedRectAnimator::animValWillChange):
(WebCore::SVGAnimatedRectAnimator::animValDidChange):
* svg/SVGAnimatedRect.h:
(SVGAnimatedRectAnimator):
* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::supportsAnimVal):

LayoutTests:

Extend SVGAnimatedRect tests to cover animVal support.

* svg/animations/script-tests/svgrect-animation-1.js:
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgrect-animation-2.js:
(sample1):
(sample2):
(sample3):
* svg/animations/svgrect-animation-1-expected.txt:
* svg/animations/svgrect-animation-2-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (112246 => 112247)


--- trunk/LayoutTests/ChangeLog	2012-03-27 10:44:12 UTC (rev 112246)
+++ trunk/LayoutTests/ChangeLog	2012-03-27 10:47:05 UTC (rev 112247)
@@ -1,5 +1,25 @@
 2012-03-27  Nikolas Zimmermann  <nzimmerm...@rim.com>
 
+        Enable animVal support for SVGAnimatedRect
+        https://bugs.webkit.org/show_bug.cgi?id=82317
+
+        Reviewed by Zoltan Herczeg.
+
+        Extend SVGAnimatedRect tests to cover animVal support.
+
+        * svg/animations/script-tests/svgrect-animation-1.js:
+        (sample1):
+        (sample2):
+        (sample3):
+        * svg/animations/script-tests/svgrect-animation-2.js:
+        (sample1):
+        (sample2):
+        (sample3):
+        * svg/animations/svgrect-animation-1-expected.txt:
+        * svg/animations/svgrect-animation-2-expected.txt:
+
+2012-03-27  Nikolas Zimmermann  <nzimmerm...@rim.com>
+
         Not reviewed. Use shouldBe() instead of shouldBeCloseEnough() when testing the baseVal in the SVGAngle tests.
         It doesn't get animated, and thus isn't timing dependant. All other tests are correct.
 

Modified: trunk/LayoutTests/svg/animations/script-tests/svgrect-animation-1.js (112246 => 112247)


--- trunk/LayoutTests/svg/animations/script-tests/svgrect-animation-1.js	2012-03-27 10:44:12 UTC (rev 112246)
+++ trunk/LayoutTests/svg/animations/script-tests/svgrect-animation-1.js	2012-03-27 10:47:05 UTC (rev 112247)
@@ -29,10 +29,10 @@
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.width", "100");
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.height", "100");
 
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.x", "0");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.y", "0");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.width", "100");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.height", "100");
+    shouldBe("rootSVGElement.viewBox.baseVal.x", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.y", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.width", "100");
+    shouldBe("rootSVGElement.viewBox.baseVal.height", "100");
 }
 
 function sample2() {
@@ -41,10 +41,10 @@
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.width", "75");
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.height", "75");
 
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.x", "25");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.y", "25");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.width", "75");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.height", "75");
+    shouldBe("rootSVGElement.viewBox.baseVal.x", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.y", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.width", "100");
+    shouldBe("rootSVGElement.viewBox.baseVal.height", "100");
 }
 
 function sample3() {
@@ -53,10 +53,10 @@
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.width", "50");
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.height", "50");
 
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.x", "50");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.y", "50");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.width", "50");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.height", "50");
+    shouldBe("rootSVGElement.viewBox.baseVal.x", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.y", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.width", "100");
+    shouldBe("rootSVGElement.viewBox.baseVal.height", "100");
 }
 
 function executeTest() {

Modified: trunk/LayoutTests/svg/animations/script-tests/svgrect-animation-2.js (112246 => 112247)


--- trunk/LayoutTests/svg/animations/script-tests/svgrect-animation-2.js	2012-03-27 10:44:12 UTC (rev 112246)
+++ trunk/LayoutTests/svg/animations/script-tests/svgrect-animation-2.js	2012-03-27 10:47:05 UTC (rev 112247)
@@ -29,10 +29,10 @@
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.width", "100");
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.height", "100");
 
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.x", "0");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.y", "0");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.width", "100");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.height", "100");
+    shouldBe("rootSVGElement.viewBox.baseVal.x", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.y", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.width", "100");
+    shouldBe("rootSVGElement.viewBox.baseVal.height", "100");
 }
 
 function sample2() {
@@ -41,10 +41,10 @@
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.width", "125");
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.height", "125");
 
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.x", "25");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.y", "25");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.width", "125");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.height", "125");
+    shouldBe("rootSVGElement.viewBox.baseVal.x", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.y", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.width", "100");
+    shouldBe("rootSVGElement.viewBox.baseVal.height", "100");
 }
 
 function sample3() {
@@ -53,10 +53,10 @@
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.width", "150");
     shouldBeCloseEnough("rootSVGElement.viewBox.animVal.height", "150");
 
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.x", "50");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.y", "50");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.width", "150");
-    shouldBeCloseEnough("rootSVGElement.viewBox.baseVal.height", "150");
+    shouldBe("rootSVGElement.viewBox.baseVal.x", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.y", "0");
+    shouldBe("rootSVGElement.viewBox.baseVal.width", "100");
+    shouldBe("rootSVGElement.viewBox.baseVal.height", "100");
 }
 
 function executeTest() {

Modified: trunk/LayoutTests/svg/animations/svgrect-animation-1-expected.txt (112246 => 112247)


--- trunk/LayoutTests/svg/animations/svgrect-animation-1-expected.txt	2012-03-27 10:44:12 UTC (rev 112246)
+++ trunk/LayoutTests/svg/animations/svgrect-animation-1-expected.txt	2012-03-27 10:47:05 UTC (rev 112247)
@@ -17,18 +17,18 @@
 PASS rootSVGElement.viewBox.animVal.y is 25
 PASS rootSVGElement.viewBox.animVal.width is 75
 PASS rootSVGElement.viewBox.animVal.height is 75
-PASS rootSVGElement.viewBox.baseVal.x is 25
-PASS rootSVGElement.viewBox.baseVal.y is 25
-PASS rootSVGElement.viewBox.baseVal.width is 75
-PASS rootSVGElement.viewBox.baseVal.height is 75
+PASS rootSVGElement.viewBox.baseVal.x is 0
+PASS rootSVGElement.viewBox.baseVal.y is 0
+PASS rootSVGElement.viewBox.baseVal.width is 100
+PASS rootSVGElement.viewBox.baseVal.height is 100
 PASS rootSVGElement.viewBox.animVal.x is 50
 PASS rootSVGElement.viewBox.animVal.y is 50
 PASS rootSVGElement.viewBox.animVal.width is 50
 PASS rootSVGElement.viewBox.animVal.height is 50
-PASS rootSVGElement.viewBox.baseVal.x is 50
-PASS rootSVGElement.viewBox.baseVal.y is 50
-PASS rootSVGElement.viewBox.baseVal.width is 50
-PASS rootSVGElement.viewBox.baseVal.height is 50
+PASS rootSVGElement.viewBox.baseVal.x is 0
+PASS rootSVGElement.viewBox.baseVal.y is 0
+PASS rootSVGElement.viewBox.baseVal.width is 100
+PASS rootSVGElement.viewBox.baseVal.height is 100
 PASS rootSVGElement.viewBox.animVal.x is 0
 PASS rootSVGElement.viewBox.animVal.y is 0
 PASS rootSVGElement.viewBox.animVal.width is 100

Modified: trunk/LayoutTests/svg/animations/svgrect-animation-2-expected.txt (112246 => 112247)


--- trunk/LayoutTests/svg/animations/svgrect-animation-2-expected.txt	2012-03-27 10:44:12 UTC (rev 112246)
+++ trunk/LayoutTests/svg/animations/svgrect-animation-2-expected.txt	2012-03-27 10:47:05 UTC (rev 112247)
@@ -17,18 +17,18 @@
 PASS rootSVGElement.viewBox.animVal.y is 25
 PASS rootSVGElement.viewBox.animVal.width is 125
 PASS rootSVGElement.viewBox.animVal.height is 125
-PASS rootSVGElement.viewBox.baseVal.x is 25
-PASS rootSVGElement.viewBox.baseVal.y is 25
-PASS rootSVGElement.viewBox.baseVal.width is 125
-PASS rootSVGElement.viewBox.baseVal.height is 125
+PASS rootSVGElement.viewBox.baseVal.x is 0
+PASS rootSVGElement.viewBox.baseVal.y is 0
+PASS rootSVGElement.viewBox.baseVal.width is 100
+PASS rootSVGElement.viewBox.baseVal.height is 100
 PASS rootSVGElement.viewBox.animVal.x is 50
 PASS rootSVGElement.viewBox.animVal.y is 50
 PASS rootSVGElement.viewBox.animVal.width is 150
 PASS rootSVGElement.viewBox.animVal.height is 150
-PASS rootSVGElement.viewBox.baseVal.x is 50
-PASS rootSVGElement.viewBox.baseVal.y is 50
-PASS rootSVGElement.viewBox.baseVal.width is 150
-PASS rootSVGElement.viewBox.baseVal.height is 150
+PASS rootSVGElement.viewBox.baseVal.x is 0
+PASS rootSVGElement.viewBox.baseVal.y is 0
+PASS rootSVGElement.viewBox.baseVal.width is 100
+PASS rootSVGElement.viewBox.baseVal.height is 100
 PASS rootSVGElement.viewBox.animVal.x is 0
 PASS rootSVGElement.viewBox.animVal.y is 0
 PASS rootSVGElement.viewBox.animVal.width is 100

Modified: trunk/Source/WebCore/ChangeLog (112246 => 112247)


--- trunk/Source/WebCore/ChangeLog	2012-03-27 10:44:12 UTC (rev 112246)
+++ trunk/Source/WebCore/ChangeLog	2012-03-27 10:47:05 UTC (rev 112247)
@@ -1,3 +1,26 @@
+2012-03-27  Nikolas Zimmermann  <nzimmerm...@rim.com>
+
+        Enable animVal support for SVGAnimatedRect
+        https://bugs.webkit.org/show_bug.cgi?id=82317
+
+        Reviewed by Zoltan Herczeg.
+
+        Enable animVal support for SVGAnimatedRect. Very simple now that everything is prepared.
+        All we have to do is add startAnimValAnimation/etc. methods to SVGAnimatedRectAnimator.
+
+        Extended existing tests to cover this.
+
+        * svg/SVGAnimatedRect.cpp:
+        (WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
+        (WebCore::SVGAnimatedRectAnimator::stopAnimValAnimation):
+        (WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
+        (WebCore::SVGAnimatedRectAnimator::animValWillChange):
+        (WebCore::SVGAnimatedRectAnimator::animValDidChange):
+        * svg/SVGAnimatedRect.h:
+        (SVGAnimatedRectAnimator):
+        * svg/SVGAnimatedType.cpp:
+        (WebCore::SVGAnimatedType::supportsAnimVal):
+
 2012-03-27  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r112201.

Modified: trunk/Source/WebCore/svg/SVGAnimatedRect.cpp (112246 => 112247)


--- trunk/Source/WebCore/svg/SVGAnimatedRect.cpp	2012-03-27 10:44:12 UTC (rev 112246)
+++ trunk/Source/WebCore/svg/SVGAnimatedRect.cpp	2012-03-27 10:47:05 UTC (rev 112247)
@@ -39,6 +39,31 @@
     return animatedType.release();
 }
 
+PassOwnPtr<SVGAnimatedType> SVGAnimatedRectAnimator::startAnimValAnimation(const Vector<SVGAnimatedProperty*>& properties)
+{
+    return SVGAnimatedType::createRect(constructFromOneBaseValue<FloatRect, SVGAnimatedRect>(properties));
+}
+
+void SVGAnimatedRectAnimator::stopAnimValAnimation(const Vector<SVGAnimatedProperty*>& properties)
+{
+    SVGAnimatedTypeAnimator::stopAnimValAnimationForType<SVGAnimatedRect>(properties);
+}
+
+void SVGAnimatedRectAnimator::resetAnimValToBaseVal(const Vector<SVGAnimatedProperty*>& properties, SVGAnimatedType* type)
+{
+    resetFromOneBaseValue<FloatRect, SVGAnimatedRect>(properties, type, &SVGAnimatedType::rect);
+}
+
+void SVGAnimatedRectAnimator::animValWillChange(const Vector<SVGAnimatedProperty*>& properties)
+{
+    animValWillChangeForType<SVGAnimatedRect>(properties);
+}
+
+void SVGAnimatedRectAnimator::animValDidChange(const Vector<SVGAnimatedProperty*>& properties)
+{
+    animValDidChangeForType<SVGAnimatedRect>(properties);
+}
+
 void SVGAnimatedRectAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
 {
     from = constructFromString(fromString);

Modified: trunk/Source/WebCore/svg/SVGAnimatedRect.h (112246 => 112247)


--- trunk/Source/WebCore/svg/SVGAnimatedRect.h	2012-03-27 10:44:12 UTC (rev 112246)
+++ trunk/Source/WebCore/svg/SVGAnimatedRect.h	2012-03-27 10:47:05 UTC (rev 112247)
@@ -40,12 +40,16 @@
 class SVGAnimationElement;
 
 class SVGAnimatedRectAnimator : public SVGAnimatedTypeAnimator {
-
 public:
     SVGAnimatedRectAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedRectAnimator() { }
 
     virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&);
+    virtual PassOwnPtr<SVGAnimatedType> startAnimValAnimation(const Vector<SVGAnimatedProperty*>&);
+    virtual void stopAnimValAnimation(const Vector<SVGAnimatedProperty*>&);
+    virtual void resetAnimValToBaseVal(const Vector<SVGAnimatedProperty*>&, SVGAnimatedType*);
+    virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
+    virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
 
     virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
     virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);

Modified: trunk/Source/WebCore/svg/SVGAnimatedType.cpp (112246 => 112247)


--- trunk/Source/WebCore/svg/SVGAnimatedType.cpp	2012-03-27 10:44:12 UTC (rev 112246)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.cpp	2012-03-27 10:47:05 UTC (rev 112247)
@@ -479,6 +479,7 @@
     case AnimatedNumber:
     case AnimatedNumberList:
     case AnimatedNumberOptionalNumber:
+    case AnimatedRect:
     case AnimatedString:
     case AnimatedTransformList:
         return true;
@@ -487,7 +488,6 @@
     case AnimatedPath:
     case AnimatedPoints:
     case AnimatedPreserveAspectRatio:
-    case AnimatedRect:
     case AnimatedUnknown:
         return false;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to