This source file includes following definitions.
- setValue
- setValueInSpecifiedUnits
- newValueSpecifiedUnits
- convertToSpecifiedUnits
- setValueAsString
#include "config.h"
#include "core/svg/SVGAngleTearOff.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)
: SVGPropertyTearOff<SVGAngle>(targetProperty, contextElement, propertyIsAnimVal, attributeName)
{
ScriptWrappable::init(this);
}
SVGAngleTearOff::~SVGAngleTearOff()
{
}
void SVGAngleTearOff::setValue(float value, ExceptionState& exceptionState)
{
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
return;
}
target()->setValue(value);
commitChange();
}
void SVGAngleTearOff::setValueInSpecifiedUnits(float value, ExceptionState& exceptionState)
{
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
return;
}
target()->setValueInSpecifiedUnits(value);
commitChange();
}
void SVGAngleTearOff::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, 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);
commitChange();
}
void SVGAngleTearOff::convertToSpecifiedUnits(unsigned short unitType, 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) + ").");
return;
}
target()->convertToSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitType), exceptionState);
if (!exceptionState.hadException())
commitChange();
}
void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exceptionState)
{
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
return;
}
target()->setValueAsString(value, exceptionState);
commitChange();
}
}