Index: Source/core/svg/SVGTransformTearOff.cpp |
diff --git a/Source/core/svg/SVGAngleTearOff.cpp b/Source/core/svg/SVGTransformTearOff.cpp |
similarity index 60% |
copy from Source/core/svg/SVGAngleTearOff.cpp |
copy to Source/core/svg/SVGTransformTearOff.cpp |
index c1408ea7fc20c77ac18fff861eab570230a0e931..c13631a788515a44b0d283fa9b1dcdfc8088b7f3 100644 |
--- a/Source/core/svg/SVGAngleTearOff.cpp |
+++ b/Source/core/svg/SVGTransformTearOff.cpp |
@@ -29,86 +29,95 @@ |
*/ |
#include "config.h" |
-#include "core/svg/SVGAngleTearOff.h" |
+#include "core/svg/SVGTransformTearOff.h" |
#include "bindings/v8/ExceptionState.h" |
#include "core/dom/ExceptionCode.h" |
namespace WebCore { |
-SVGAngleTearOff::SVGAngleTearOff(PassRefPtr<SVGAngle> targetProperty, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName) |
- : NewSVGPropertyTearOff<SVGAngle>(targetProperty, contextElement, propertyIsAnimVal, attributeName) |
+SVGTransformTearOff::SVGTransformTearOff(PassRefPtr<SVGTransform> target, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName) |
+ : NewSVGPropertyTearOff<SVGTransform>(target, contextElement, propertyIsAnimVal, attributeName) |
{ |
ScriptWrappable::init(this); |
} |
-SVGAngleTearOff::~SVGAngleTearOff() |
+SVGTransformTearOff::~SVGTransformTearOff() |
{ |
} |
-void SVGAngleTearOff::setValue(float value, ExceptionState& exceptionState) |
+SVGMatrixTearOff* SVGTransformTearOff::matrix() |
+{ |
+ if (!m_matrixTearoff) { |
+ m_matrixTearoff = SVGMatrixTearOff::create(this); |
+ } |
+ |
+ return m_matrixTearoff.get(); |
+} |
+ |
+void SVGTransformTearOff::setMatrix(PassRefPtr<SVGMatrixTearOff> matrix, ExceptionState& exceptionState) |
{ |
if (isImmutable()) { |
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); |
return; |
} |
- target()->setValue(value); |
+ target()->setMatrix(matrix->value()); |
commitChange(); |
} |
-void SVGAngleTearOff::setValueInSpecifiedUnits(float value, ExceptionState& exceptionState) |
+void SVGTransformTearOff::setTranslate(float tx, float ty, ExceptionState& exceptionState) |
{ |
if (isImmutable()) { |
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); |
return; |
} |
- target()->setValueInSpecifiedUnits(value); |
+ target()->setTranslate(tx, ty); |
commitChange(); |
} |
-void SVGAngleTearOff::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionState& exceptionState) |
+void SVGTransformTearOff::setScale(float sx, float sy, ExceptionState& exceptionState) |
{ |
if (isImmutable()) { |
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); |
return; |
} |
- if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_ANGLETYPE_GRAD) { |
- exceptionState.throwDOMException(NotSupportedError, "Cannot set value with unknown or invalid units (" + String::number(unitType) + ")."); |
- return; |
- } |
- |
- target()->newValueSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitType), valueInSpecifiedUnits); |
+ target()->setScale(sx, sy); |
commitChange(); |
} |
-void SVGAngleTearOff::convertToSpecifiedUnits(unsigned short unitType, ExceptionState& exceptionState) |
+void SVGTransformTearOff::setRotate(float angle, float cx, float cy, ExceptionState& exceptionState) |
{ |
if (isImmutable()) { |
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); |
return; |
} |
- if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_ANGLETYPE_GRAD) { |
- exceptionState.throwDOMException(NotSupportedError, "Cannot convert to unknown or invalid units (" + String::number(unitType) + ")."); |
+ target()->setRotate(angle, cx, cy); |
+ commitChange(); |
+} |
+ |
+void SVGTransformTearOff::setSkewX(float x, ExceptionState& exceptionState) |
+{ |
+ if (isImmutable()) { |
+ exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); |
return; |
} |
- target()->convertToSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitType), exceptionState); |
- if (!exceptionState.hadException()) |
- commitChange(); |
+ target()->setSkewX(x); |
+ commitChange(); |
} |
-void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exceptionState) |
+void SVGTransformTearOff::setSkewY(float y, ExceptionState& exceptionState) |
{ |
if (isImmutable()) { |
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); |
return; |
} |
- target()->setValueAsString(value, exceptionState); |
+ target()->setSkewY(y); |
commitChange(); |
} |