SVGPreserveAspectRatio.h [plain text]
#pragma once
#include "SVGPreserveAspectRatioValue.h"
#include "SVGValueProperty.h"
namespace WebCore {
class SVGPreserveAspectRatio : public SVGValueProperty<SVGPreserveAspectRatioValue> {
using Base = SVGValueProperty<SVGPreserveAspectRatioValue>;
using Base::Base;
using Base::m_value;
public:
static Ref<SVGPreserveAspectRatio> create(SVGPropertyOwner* owner, SVGPropertyAccess access, const SVGPreserveAspectRatioValue& value = { })
{
return adoptRef(*new SVGPreserveAspectRatio(owner, access, value));
}
template<typename T>
static ExceptionOr<Ref<SVGPreserveAspectRatio>> create(ExceptionOr<T>&& value)
{
if (value.hasException())
return value.releaseException();
return adoptRef(*new SVGPreserveAspectRatio(value.releaseReturnValue()));
}
unsigned short align() const { return m_value.align(); }
ExceptionOr<void> setAlign(float value)
{
if (isReadOnly())
return Exception { NoModificationAllowedError };
auto result = m_value.setAlign(value);
if (result.hasException())
return result;
commitChange();
return result;
}
unsigned short meetOrSlice() const { return m_value.meetOrSlice(); }
ExceptionOr<void> setMeetOrSlice(float value)
{
if (isReadOnly())
return Exception { NoModificationAllowedError };
auto result = m_value.setMeetOrSlice(value);
if (result.hasException())
return result;
commitChange();
return result;
}
String valueAsString() const override
{
return m_value.valueAsString();
}
};
}