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

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

Issue 112003003: [SVG] SVGLength{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined Created 7 years 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
Index: Source/core/svg/SVGLineElement.cpp
diff --git a/Source/core/svg/SVGLineElement.cpp b/Source/core/svg/SVGLineElement.cpp
index 05ffe1509e18ab55d3aedf4d0fcfc24d3c25bd98..d127eb8400dae3a050f18f72487d8f95ae43b7fa 100644
--- a/Source/core/svg/SVGLineElement.cpp
+++ b/Source/core/svg/SVGLineElement.cpp
@@ -29,29 +29,26 @@
namespace WebCore {
// Animated property definitions
-DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x1Attr, X1, x1)
-DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y1Attr, Y1, y1)
-DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x2Attr, X2, x2)
-DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y2Attr, Y2, y2)
DEFINE_ANIMATED_BOOLEAN(SVGLineElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLineElement)
- REGISTER_LOCAL_ANIMATED_PROPERTY(x1)
- REGISTER_LOCAL_ANIMATED_PROPERTY(y1)
- REGISTER_LOCAL_ANIMATED_PROPERTY(x2)
- REGISTER_LOCAL_ANIMATED_PROPERTY(y2)
REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
END_REGISTER_ANIMATED_PROPERTIES
inline SVGLineElement::SVGLineElement(Document& document)
: SVGGeometryElement(SVGNames::lineTag, document)
- , m_x1(LengthModeWidth)
- , m_y1(LengthModeHeight)
- , m_x2(LengthModeWidth)
- , m_y2(LengthModeHeight)
+ , m_x1(SVGAnimatedLength::create(this, SVGNames::x1Attr, SVGLength::create(LengthModeWidth)))
+ , m_y1(SVGAnimatedLength::create(this, SVGNames::y1Attr, SVGLength::create(LengthModeHeight)))
+ , m_x2(SVGAnimatedLength::create(this, SVGNames::x2Attr, SVGLength::create(LengthModeWidth)))
+ , m_y2(SVGAnimatedLength::create(this, SVGNames::y2Attr, SVGLength::create(LengthModeHeight)))
{
ScriptWrappable::init(this);
+
+ addToPropertyMap(m_x1);
+ addToPropertyMap(m_y1);
+ addToPropertyMap(m_x2);
+ addToPropertyMap(m_y2);
registerAnimatedPropertiesForSVGLineElement();
}
@@ -80,13 +77,13 @@ void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin
if (!isSupportedAttribute(name))
SVGGeometryElement::parseAttribute(name, value);
else if (name == SVGNames::x1Attr)
- setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+ m_x1->setBaseValueAsString(value, AllowNegativeLengths, parseError);
else if (name == SVGNames::y1Attr)
- setY1BaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+ m_y1->setBaseValueAsString(value, AllowNegativeLengths, parseError);
else if (name == SVGNames::x2Attr)
- setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+ m_x2->setBaseValueAsString(value, AllowNegativeLengths, parseError);
else if (name == SVGNames::y2Attr)
- setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
+ m_y2->setBaseValueAsString(value, AllowNegativeLengths, parseError);
else if (SVGExternalResourcesRequired::parseAttribute(name, value)) {
} else
ASSERT_NOT_REACHED();
@@ -131,10 +128,10 @@ void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName)
bool SVGLineElement::selfHasRelativeLengths() const
{
- return x1CurrentValue().isRelative()
- || y1CurrentValue().isRelative()
- || x2CurrentValue().isRelative()
- || y2CurrentValue().isRelative();
+ return m_x1->currentValue()->isRelative()
+ || m_y1->currentValue()->isRelative()
+ || m_x2->currentValue()->isRelative()
+ || m_y2->currentValue()->isRelative();
}
}

Powered by Google App Engine
This is Rietveld 408576698