This source file includes following definitions.
- setAlign
- setMeetOrSlice
#include "config.h"
#include "core/svg/SVGPreserveAspectRatioTearOff.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
namespace WebCore {
void SVGPreserveAspectRatioTearOff::setAlign(unsigned short align, ExceptionState& exceptionState)
{
if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX) {
exceptionState.throwDOMException(NotSupportedError, "The alignment provided is invalid.");
return;
}
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
return;
}
target()->setAlign(static_cast<SVGPreserveAspectRatio::SVGPreserveAspectRatioType>(align));
}
void SVGPreserveAspectRatioTearOff::setMeetOrSlice(unsigned short meetOrSlice, ExceptionState& exceptionState)
{
if (meetOrSlice == SVG_MEETORSLICE_UNKNOWN || meetOrSlice > SVG_MEETORSLICE_SLICE) {
exceptionState.throwDOMException(NotSupportedError, "The meetOrSlice provided is invalid.");
return;
}
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
return;
}
target()->setMeetOrSlice(static_cast<SVGPreserveAspectRatio::SVGMeetOrSliceType>(meetOrSlice));
}
SVGPreserveAspectRatioTearOff::SVGPreserveAspectRatioTearOff(PassRefPtr<SVGPreserveAspectRatio> target, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName)
: SVGPropertyTearOff<SVGPreserveAspectRatio>(target, contextElement, propertyIsAnimVal, attributeName)
{
ScriptWrappable::init(this);
}
}