Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: Source/core/svg/SVGPolyElement.cpp

Issue 132233016: [SVG] SVGAnimatedPointList migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: set NeedsRebaseline Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGPolyElement.h ('k') | Source/core/svg/SVGPolygonElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGPolyElement.cpp
diff --git a/Source/core/svg/SVGPolyElement.cpp b/Source/core/svg/SVGPolyElement.cpp
index 65a663a929a3dd65bfbc42bfa380091878d624a6..eea18f4bf8b5d5c08402d20e6f15c4357fe34cac 100644
--- a/Source/core/svg/SVGPolyElement.cpp
+++ b/Source/core/svg/SVGPolyElement.cpp
@@ -30,42 +30,17 @@
namespace WebCore {
-// Define custom animated property 'points'.
-const SVGPropertyInfo* SVGPolyElement::pointsPropertyInfo()
-{
- static const SVGPropertyInfo* s_propertyInfo = 0;
- if (!s_propertyInfo) {
- s_propertyInfo = new SVGPropertyInfo(AnimatedPoints,
- PropertyIsReadWrite,
- SVGNames::pointsAttr,
- SVGNames::pointsAttr.localName(),
- &SVGPolyElement::synchronizePoints,
- &SVGPolyElement::lookupOrCreatePointsWrapper);
- }
- return s_propertyInfo;
-}
-
-SVGPointList& SVGPolyElement::pointsCurrentValue()
-{
- SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo());
- if (wrapper && wrapper->isAnimating()) {
- if (SVGListPropertyTearOff<SVGPointList>* ap = animatedPoints())
- return ap->values();
- }
-
- return m_points.value;
-}
-
// Animated property definitions
BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement)
- REGISTER_LOCAL_ANIMATED_PROPERTY(points)
REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
END_REGISTER_ANIMATED_PROPERTIES
SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document)
: SVGGeometryElement(tagName, document)
+ , m_points(SVGAnimatedPointList::create(this, SVGNames::pointsAttr, SVGPointList::create()))
{
+ addToPropertyMap(m_points);
registerAnimatedPropertiesForSVGPolyElement();
}
@@ -86,14 +61,9 @@ void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
}
if (name == SVGNames::pointsAttr) {
- SVGPointList newList;
- if (!pointsListFromSVGData(newList, value))
- document().accessSVGExtensions()->reportError("Problem parsing points=\"" + value + "\"");
-
- if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()))
- static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newList.size());
-
- m_points.value = newList;
+ SVGParsingError parseError = NoError;
+ m_points->setBaseValueAsString(value, parseError);
+ reportAttributeParsingError(parseError, name, value);
return;
}
@@ -122,33 +92,4 @@ void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName)
ASSERT_NOT_REACHED();
}
-void SVGPolyElement::synchronizePoints(SVGElement* contextElement)
-{
- ASSERT(contextElement);
- SVGPolyElement* ownerType = toSVGPolyElement(contextElement);
- if (!ownerType->m_points.shouldSynchronize)
- return;
- ownerType->m_points.synchronize(ownerType, pointsPropertyInfo()->attributeName, AtomicString(ownerType->m_points.value.valueAsString()));
-}
-
-PassRefPtr<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement)
-{
- ASSERT(contextElement);
- SVGPolyElement* ownerType = toSVGPolyElement(contextElement);
- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPolyElement, SVGAnimatedPointList, SVGPointList>
- (ownerType, pointsPropertyInfo(), ownerType->m_points.value);
-}
-
-SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::points()
-{
- m_points.shouldSynchronize = true;
- 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<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal());
-}
-
}
« no previous file with comments | « Source/core/svg/SVGPolyElement.h ('k') | Source/core/svg/SVGPolygonElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698