SVGPreserveAspectRatio.h [plain text]
#pragma once
#include "SVGPreserveAspectRatioValue.h"
#include "SVGPropertyTearOff.h"
namespace WebCore {
class SVGPreserveAspectRatio : public SVGPropertyTearOff<SVGPreserveAspectRatioValue> {
public:
static Ref<SVGPreserveAspectRatio> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGPreserveAspectRatioValue& value)
{
return adoptRef(*new SVGPreserveAspectRatio(animatedProperty, role, value));
}
static Ref<SVGPreserveAspectRatio> create(const SVGPreserveAspectRatioValue& initialValue = { })
{
return adoptRef(*new SVGPreserveAspectRatio(initialValue));
}
template<typename T> static ExceptionOr<Ref<SVGPreserveAspectRatio>> create(ExceptionOr<T>&& initialValue)
{
if (initialValue.hasException())
return initialValue.releaseException();
return create(initialValue.releaseReturnValue());
}
unsigned short align()
{
return propertyReference().align();
}
ExceptionOr<void> setAlign(float value)
{
if (isReadOnly())
return Exception { NoModificationAllowedError };
auto result = propertyReference().setAlign(value);
if (result.hasException())
return result;
commitChange();
return result;
}
unsigned short meetOrSlice()
{
return propertyReference().meetOrSlice();
}
ExceptionOr<void> setMeetOrSlice(float value)
{
if (isReadOnly())
return Exception { NoModificationAllowedError };
auto result = propertyReference().setMeetOrSlice(value);
if (result.hasException())
return result;
commitChange();
return result;
}
private:
SVGPreserveAspectRatio(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGPreserveAspectRatioValue& value)
: SVGPropertyTearOff<SVGPreserveAspectRatioValue>(&animatedProperty, role, value)
{
}
explicit SVGPreserveAspectRatio(const SVGPreserveAspectRatioValue& initialValue)
: SVGPropertyTearOff<SVGPreserveAspectRatioValue>(initialValue)
{
}
};
}