This source file includes following definitions.
- create
- red
- green
- blue
- alpha
#include "config.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/RGBColor.h"
namespace WebCore {
PassRefPtrWillBeRawPtr<RGBColor> RGBColor::create(unsigned rgbColor)
{
return adoptRefWillBeNoop(new RGBColor(rgbColor));
}
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> RGBColor::red()
{
unsigned value = (m_rgbColor >> 16) & 0xFF;
RefPtrWillBeRawPtr<CSSPrimitiveValue> result = CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
result->setCSSOMSafe();
return result.release();
}
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> RGBColor::green()
{
unsigned value = (m_rgbColor >> 8) & 0xFF;
RefPtrWillBeRawPtr<CSSPrimitiveValue> result = CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
result->setCSSOMSafe();
return result.release();
}
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> RGBColor::blue()
{
unsigned value = m_rgbColor & 0xFF;
RefPtrWillBeRawPtr<CSSPrimitiveValue> result = CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
result->setCSSOMSafe();
return result.release();
}
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> RGBColor::alpha()
{
float value = static_cast<float>((m_rgbColor >> 24) & 0xFF) / 0xFF;
RefPtrWillBeRawPtr<CSSPrimitiveValue> result = CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER);
result->setCSSOMSafe();
return result.release();
}
}