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

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

Issue 153883003: [SVG] SVGAnimatedTransform{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove m_zoomAndPan Created 6 years, 10 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/SVGGraphicsElement.h ('k') | Source/core/svg/SVGGraphicsElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGGraphicsElement.cpp
diff --git a/Source/core/svg/SVGGraphicsElement.cpp b/Source/core/svg/SVGGraphicsElement.cpp
index b02670e20cc4b83c76781e5d019443ac8b64e7f1..1f4a7c5d56fe8c8dd35fc7a07d22bcc02d52e321 100644
--- a/Source/core/svg/SVGGraphicsElement.cpp
+++ b/Source/core/svg/SVGGraphicsElement.cpp
@@ -32,17 +32,17 @@
namespace WebCore {
// Animated property definitions
-DEFINE_ANIMATED_TRANSFORM_LIST(SVGGraphicsElement, SVGNames::transformAttr, Transform, transform)
BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGraphicsElement)
- REGISTER_LOCAL_ANIMATED_PROPERTY(transform)
REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
END_REGISTER_ANIMATED_PROPERTIES
SVGGraphicsElement::SVGGraphicsElement(const QualifiedName& tagName, Document& document, ConstructionType constructionType)
: SVGElement(tagName, document, constructionType)
, SVGTests(this)
+ , m_transform(SVGAnimatedTransformList::create(this, SVGNames::transformAttr, SVGTransformList::create()))
{
+ addToPropertyMap(m_transform);
registerAnimatedPropertiesForSVGGraphicsElement();
}
@@ -50,7 +50,7 @@ SVGGraphicsElement::~SVGGraphicsElement()
{
}
-AffineTransform SVGGraphicsElement::getTransformToElement(SVGElement* target, ExceptionState& exceptionState)
+PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getTransformToElement(SVGElement* target, ExceptionState& exceptionState)
{
AffineTransform ctm = getCTM(AllowStyleUpdate);
@@ -58,12 +58,12 @@ AffineTransform SVGGraphicsElement::getTransformToElement(SVGElement* target, Ex
AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(AllowStyleUpdate);
if (!targetCTM.isInvertible()) {
exceptionState.throwDOMException(InvalidStateError, "The target transformation is not invertable.");
- return ctm;
+ return 0;
}
ctm = targetCTM.inverse() * ctm;
}
- return ctm;
+ return SVGMatrixTearOff::create(ctm);
}
static AffineTransform computeCTM(SVGGraphicsElement* element, SVGElement::CTMScope mode, SVGGraphicsElement::StyleUpdateStrategy styleUpdateStrategy)
@@ -99,6 +99,16 @@ AffineTransform SVGGraphicsElement::getScreenCTM(StyleUpdateStrategy styleUpdate
return computeCTM(this, ScreenScope, styleUpdateStrategy);
}
+PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getCTMFromJavascript()
+{
+ return SVGMatrixTearOff::create(getCTM());
+}
+
+PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJavascript()
+{
+ return SVGMatrixTearOff::create(getScreenCTM());
+}
+
AffineTransform SVGGraphicsElement::animatedLocalTransform() const
{
AffineTransform matrix;
@@ -122,7 +132,7 @@ AffineTransform SVGGraphicsElement::animatedLocalTransform() const
matrix.setF(matrix.f() / zoom);
}
} else {
- transformCurrentValue().concatenate(matrix);
+ m_transform->currentValue()->concatenate(matrix);
}
if (m_supplementalTransform)
@@ -154,17 +164,16 @@ void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicS
return;
}
- if (name == SVGNames::transformAttr) {
- SVGTransformList newList;
- newList.parse(value);
- detachAnimatedTransformListWrappers(newList.size());
- setTransformBaseValue(newList);
- return;
- } else if (SVGTests::parseAttribute(name, value)) {
+ SVGParsingError parseError = NoError;
+
+ if (name == SVGNames::transformAttr)
+ m_transform->setBaseValueAsString(value, parseError);
+ else if (SVGTests::parseAttribute(name, value))
return;
- }
+ else
+ ASSERT_NOT_REACHED();
- ASSERT_NOT_REACHED();
+ reportAttributeParsingError(parseError, name, value);
}
void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName)
« no previous file with comments | « Source/core/svg/SVGGraphicsElement.h ('k') | Source/core/svg/SVGGraphicsElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698