https://bugs.webkit.org/show_bug.cgi?id=82844
Reviewed by Dirk Schulze.
Source/WebCore:
When the points attribute of a SVGPoly*Element is animated, we should animate
the 'animatedPoints' SVG DOM property, not the 'points' property, which corresponds
to the "baseVal". Fix that, now only the 'd' attribute for SVGPathElement is incorrect,
everything else is moved to the new animVal concept!
* svg/SVGAnimatedPointList.cpp:
(WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedPointListAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedPointListAnimator::animValWillChange):
(WebCore::SVGAnimatedPointListAnimator::animValDidChange):
* svg/SVGAnimatedPointList.h:
(SVGAnimatedPointListAnimator):
* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::valueAsString):
(WebCore::SVGAnimatedType::setValueAsString):
(WebCore::SVGAnimatedType::supportsAnimVal):
* svg/SVGPolyElement.cpp:
(WebCore::SVGPolyElement::parseAttribute):
(WebCore::SVGPolyElement::lookupOrCreatePointsWrapper):
(WebCore::SVGPolyElement::points):
(WebCore::SVGPolyElement::animatedPoints):
LayoutTests:
Update SVGPointList animation tests, verifying that animatedPoints is animated, and not points.
* svg/animations/script-tests/svgpointlist-animation-1.js:
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svgpointlist-animation-2.js:
(sample1):
(sample2):
(sample3):
* svg/animations/svgpointlist-animation-1-expected.txt:
* svg/animations/svgpointlist-animation-2-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113008
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-01 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Animate animatedPoints instead of points for SVGPoly*Elements
+ https://bugs.webkit.org/show_bug.cgi?id=82844
+
+ Reviewed by Dirk Schulze.
+
+ Update SVGPointList animation tests, verifying that animatedPoints is animated, and not points.
+
+ * svg/animations/script-tests/svgpointlist-animation-1.js:
+ (sample1):
+ (sample2):
+ (sample3):
+ * svg/animations/script-tests/svgpointlist-animation-2.js:
+ (sample1):
+ (sample2):
+ (sample3):
+ * svg/animations/svgpointlist-animation-1-expected.txt:
+ * svg/animations/svgpointlist-animation-2-expected.txt:
+
2012-04-03 Philippe Normand <pnormand@igalia.com>
[GTK] media/video-volume.html fails on 32-bits debug
// Setup animation test
function sample1() {
// Check initial/end conditions
- shouldBeCloseEnough("poly.points.getItem(2).x", "200");
- shouldBeCloseEnough("poly.points.getItem(2).y", "200");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "200");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "200");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "200");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "200");
+
+ shouldBe("poly.points.getItem(2).x", "200");
+ shouldBe("poly.points.getItem(2).y", "200");
}
function sample2() {
// Check half-time conditions
- shouldBeCloseEnough("poly.points.getItem(2).x", "150");
- shouldBeCloseEnough("poly.points.getItem(2).y", "150");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "250");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "250");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "150");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "150");
+
+ shouldBe("poly.points.getItem(2).x", "200");
+ shouldBe("poly.points.getItem(2).y", "200");
}
function sample3() {
// Check just before-end conditions
- shouldBeCloseEnough("poly.points.getItem(2).x", "100");
- shouldBeCloseEnough("poly.points.getItem(2).y", "100");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "300");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "300");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "100");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "100");
+
+ shouldBe("poly.points.getItem(2).x", "200");
+ shouldBe("poly.points.getItem(2).y", "200");
}
function executeTest() {
// Setup animation test
function sample1() {
// Check initial/end conditions
- shouldBeCloseEnough("poly.points.getItem(2).x", "200");
- shouldBeCloseEnough("poly.points.getItem(2).y", "200");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "200");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "200");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "200");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "200");
+
+ shouldBe("poly.points.getItem(2).x", "200");
+ shouldBe("poly.points.getItem(2).y", "200");
}
function sample2() {
// Check half-time conditions
- shouldBeCloseEnough("poly.points.getItem(2).x", "250");
- shouldBeCloseEnough("poly.points.getItem(2).y", "250");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "250");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "250");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "250");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "250");
+
+ shouldBe("poly.points.getItem(2).x", "200");
+ shouldBe("poly.points.getItem(2).y", "200");
}
function sample3() {
// Check just before-end conditions
- shouldBeCloseEnough("poly.points.getItem(2).x", "300");
- shouldBeCloseEnough("poly.points.getItem(2).y", "300");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "300");
- // shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "300");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).x", "300");
+ shouldBeCloseEnough("poly.animatedPoints.getItem(2).y", "300");
+
+ shouldBe("poly.points.getItem(2).x", "200");
+ shouldBe("poly.points.getItem(2).y", "200");
}
function executeTest() {
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS poly.animatedPoints.getItem(2).x is 200
+PASS poly.animatedPoints.getItem(2).y is 200
PASS poly.points.getItem(2).x is 200
PASS poly.points.getItem(2).y is 200
-PASS poly.points.getItem(2).x is 150
-PASS poly.points.getItem(2).y is 150
-PASS poly.points.getItem(2).x is 100
-PASS poly.points.getItem(2).y is 100
+PASS poly.animatedPoints.getItem(2).x is 150
+PASS poly.animatedPoints.getItem(2).y is 150
+PASS poly.points.getItem(2).x is 200
+PASS poly.points.getItem(2).y is 200
+PASS poly.animatedPoints.getItem(2).x is 100
+PASS poly.animatedPoints.getItem(2).y is 100
+PASS poly.points.getItem(2).x is 200
+PASS poly.points.getItem(2).y is 200
+PASS poly.animatedPoints.getItem(2).x is 200
+PASS poly.animatedPoints.getItem(2).y is 200
PASS poly.points.getItem(2).x is 200
PASS poly.points.getItem(2).y is 200
PASS successfullyParsed is true
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS poly.animatedPoints.getItem(2).x is 200
+PASS poly.animatedPoints.getItem(2).y is 200
PASS poly.points.getItem(2).x is 200
PASS poly.points.getItem(2).y is 200
-PASS poly.points.getItem(2).x is 250
-PASS poly.points.getItem(2).y is 250
-PASS poly.points.getItem(2).x is 300
-PASS poly.points.getItem(2).y is 300
+PASS poly.animatedPoints.getItem(2).x is 250
+PASS poly.animatedPoints.getItem(2).y is 250
+PASS poly.points.getItem(2).x is 200
+PASS poly.points.getItem(2).y is 200
+PASS poly.animatedPoints.getItem(2).x is 300
+PASS poly.animatedPoints.getItem(2).y is 300
+PASS poly.points.getItem(2).x is 200
+PASS poly.points.getItem(2).y is 200
+PASS poly.animatedPoints.getItem(2).x is 200
+PASS poly.animatedPoints.getItem(2).y is 200
PASS poly.points.getItem(2).x is 200
PASS poly.points.getItem(2).y is 200
PASS successfullyParsed is true
+2012-04-01 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Animate animatedPoints instead of points for SVGPoly*Elements
+ https://bugs.webkit.org/show_bug.cgi?id=82844
+
+ Reviewed by Dirk Schulze.
+
+ When the points attribute of a SVGPoly*Element is animated, we should animate
+ the 'animatedPoints' SVG DOM property, not the 'points' property, which corresponds
+ to the "baseVal". Fix that, now only the 'd' attribute for SVGPathElement is incorrect,
+ everything else is moved to the new animVal concept!
+
+ * svg/SVGAnimatedPointList.cpp:
+ (WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation):
+ (WebCore::SVGAnimatedPointListAnimator::stopAnimValAnimation):
+ (WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal):
+ (WebCore::SVGAnimatedPointListAnimator::animValWillChange):
+ (WebCore::SVGAnimatedPointListAnimator::animValDidChange):
+ * svg/SVGAnimatedPointList.h:
+ (SVGAnimatedPointListAnimator):
+ * svg/SVGAnimatedType.cpp:
+ (WebCore::SVGAnimatedType::valueAsString):
+ (WebCore::SVGAnimatedType::setValueAsString):
+ (WebCore::SVGAnimatedType::supportsAnimVal):
+ * svg/SVGPolyElement.cpp:
+ (WebCore::SVGPolyElement::parseAttribute):
+ (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper):
+ (WebCore::SVGPolyElement::points):
+ (WebCore::SVGPolyElement::animatedPoints):
+
2012-04-03 Nikolas Zimmermann <nzimmermann@rim.com>
Not reviewed. Next chromium build fix, this time for real :-)
/*
- * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2011, 2012. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
return animtedType.release();
}
+PassOwnPtr<SVGAnimatedType> SVGAnimatedPointListAnimator::startAnimValAnimation(const Vector<SVGAnimatedProperty*>& properties)
+{
+ return SVGAnimatedType::createPointList(constructFromBaseValue<SVGAnimatedPointList>(properties));
+}
+
+void SVGAnimatedPointListAnimator::stopAnimValAnimation(const Vector<SVGAnimatedProperty*>& properties)
+{
+ stopAnimValAnimationForType<SVGAnimatedPointList>(properties);
+}
+
+void SVGAnimatedPointListAnimator::resetAnimValToBaseVal(const Vector<SVGAnimatedProperty*>& properties, SVGAnimatedType* type)
+{
+ resetFromBaseValue<SVGAnimatedPointList>(properties, type, &SVGAnimatedType::pointList);
+}
+
+void SVGAnimatedPointListAnimator::animValWillChange(const Vector<SVGAnimatedProperty*>& properties)
+{
+ animValWillChangeForType<SVGAnimatedPointList>(properties);
+}
+
+void SVGAnimatedPointListAnimator::animValDidChange(const Vector<SVGAnimatedProperty*>& properties)
+{
+ animValDidChangeForType<SVGAnimatedPointList>(properties);
+}
+
void SVGAnimatedPointListAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
{
from = constructFromString(fromString);
#define SVGAnimatedPointList_h
#if ENABLE(SVG)
+#include "SVGAnimatedListPropertyTearOff.h"
#include "SVGAnimatedTypeAnimator.h"
+#include "SVGPointList.h"
namespace WebCore {
+
+typedef SVGAnimatedListPropertyTearOff<SVGPointList> SVGAnimatedPointList;
+
class SVGAnimationElement;
class SVGAnimatedPointListAnimator : public SVGAnimatedTypeAnimator {
-
public:
SVGAnimatedPointListAnimator(SVGAnimationElement*, SVGElement*);
virtual ~SVGAnimatedPointListAnimator() { }
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);
virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
SVGPathParserFactory::self()->buildStringFromByteStream(m_data.path, result, UnalteredParsing);
return result;
}
- case AnimatedPoints:
- ASSERT(m_data.pointList);
- return m_data.pointList->valueAsString();
case AnimatedRect:
ASSERT(m_data.rect);
return String::number(m_data.rect->x()) + ' ' + String::number(m_data.rect->y()) + ' '
case AnimatedIntegerOptionalInteger:
case AnimatedNumberList:
case AnimatedNumberOptionalNumber:
+ case AnimatedPoints:
case AnimatedPreserveAspectRatio:
case AnimatedTransformList:
case AnimatedUnknown:
m_data.path = pathByteStream.leakPtr();
break;
}
- case AnimatedPoints:
- ASSERT(m_data.pointList);
- m_data.pointList->clear();
- pointsListFromSVGData(*m_data.pointList, value);
- break;
case AnimatedRect:
ASSERT(m_data.rect);
parseRect(value, *m_data.rect);
case AnimatedIntegerOptionalInteger:
case AnimatedNumberList:
case AnimatedNumberOptionalNumber:
+ case AnimatedPoints:
case AnimatedPreserveAspectRatio:
case AnimatedTransformList:
case AnimatedUnknown:
case AnimatedNumber:
case AnimatedNumberList:
case AnimatedNumberOptionalNumber:
+ case AnimatedPoints:
case AnimatedPreserveAspectRatio:
case AnimatedRect:
case AnimatedString:
// FIXME: Handle the remaining types in animVal concept.
case AnimatedPath:
- case AnimatedPoints:
case AnimatedUnknown:
return false;
}
#include "FloatPoint.h"
#include "RenderSVGPath.h"
#include "RenderSVGResource.h"
+#include "SVGAnimatedPointList.h"
#include "SVGElementInstance.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
-#include "SVGPointList.h"
namespace WebCore {
if (!pointsListFromSVGData(newList, value))
document()->accessSVGExtensions()->reportError("Problem parsing points=\"" + value + "\"");
- if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedListPropertyTearOff<SVGPointList>, true>(this, pointsPropertyInfo()))
- static_cast<SVGAnimatedListPropertyTearOff<SVGPointList>*>(wrapper)->detachListWrappers(newList.size());
+ if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList, true>(this, pointsPropertyInfo()))
+ static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newList.size());
m_points.value = newList;
return;
{
ASSERT(contextElement);
SVGPolyElement* ownerType = static_cast<SVGPolyElement*>(contextElement);
- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPolyElement, SVGAnimatedListPropertyTearOff<SVGPointList>, SVGPointList, true>
+ return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPolyElement, SVGAnimatedPointList, SVGPointList, true>
(ownerType, pointsPropertyInfo(), ownerType->m_points.value);
}
SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::points()
{
m_points.shouldSynchronize = true;
- return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cast<SVGAnimatedListPropertyTearOff<SVGPointList> >(lookupOrCreatePointsWrapper(this))->baseVal());
+ return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal());
}
SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints()
{
m_points.shouldSynchronize = true;
- return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cast<SVGAnimatedListPropertyTearOff<SVGPointList> >(lookupOrCreatePointsWrapper(this))->animVal());
+ return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal());
}
}