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

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: revert aggressive svgAttributeChanged, add 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/SVGLineElement.h ('k') | Source/core/svg/SVGLinearGradientElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGLineElement.cpp
diff --git a/Source/core/svg/SVGLineElement.cpp b/Source/core/svg/SVGLineElement.cpp
index ea2fbda548f243dfc165bd2faa4ac07b7ef949b1..1d9f7e91dba23c78290dc4e5f90eb8a91e2ff83c 100644
--- a/Source/core/svg/SVGLineElement.cpp
+++ b/Source/core/svg/SVGLineElement.cpp
@@ -29,27 +29,23 @@
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)
-
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_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();
}
@@ -77,13 +73,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
ASSERT_NOT_REACHED();
@@ -122,10 +118,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();
}
}
« no previous file with comments | « Source/core/svg/SVGLineElement.h ('k') | Source/core/svg/SVGLinearGradientElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698