DeprecatedCSSOMPrimitiveValue.cpp [plain text]
#include "config.h"
#include "DeprecatedCSSOMPrimitiveValue.h"
#include "DeprecatedCSSOMCounter.h"
#include "DeprecatedCSSOMRGBColor.h"
#include "DeprecatedCSSOMRect.h"
namespace WebCore {
unsigned short DeprecatedCSSOMPrimitiveValue::primitiveType() const
{
return static_cast<unsigned short>(m_value->primitiveType());
}
ExceptionOr<void> DeprecatedCSSOMPrimitiveValue::setFloatValue(unsigned short unitType, double floatValue)
{
return m_value->setFloatValue(static_cast<CSSUnitType>(unitType), floatValue);
}
ExceptionOr<float> DeprecatedCSSOMPrimitiveValue::getFloatValue(unsigned short unitType) const
{
return m_value->getFloatValue(static_cast<CSSUnitType>(unitType));
}
ExceptionOr<void> DeprecatedCSSOMPrimitiveValue::setStringValue(unsigned short stringType, const String& stringValue)
{
return m_value->setStringValue(static_cast<CSSUnitType>(stringType), stringValue);
}
ExceptionOr<String> DeprecatedCSSOMPrimitiveValue::getStringValue() const
{
return m_value->getStringValue();
}
ExceptionOr<Ref<DeprecatedCSSOMCounter>> DeprecatedCSSOMPrimitiveValue::getCounterValue() const
{
auto* value = m_value->counterValue();
if (!value)
return Exception { InvalidAccessError };
return DeprecatedCSSOMCounter::create(*value, m_owner);
}
ExceptionOr<Ref<DeprecatedCSSOMRect>> DeprecatedCSSOMPrimitiveValue::getRectValue() const
{
auto* value = m_value->rectValue();
if (!value)
return Exception { InvalidAccessError };
return DeprecatedCSSOMRect::create(*value, m_owner);
}
ExceptionOr<Ref<DeprecatedCSSOMRGBColor>> DeprecatedCSSOMPrimitiveValue::getRGBColorValue() const
{
if (!m_value->isRGBColor())
return Exception { InvalidAccessError };
return DeprecatedCSSOMRGBColor::create(m_owner, m_value->color());
}
}