#ifndef BorderValue_h
#define BorderValue_h
#include "Color.h"
#include "RenderStyleConstants.h"
namespace WebCore {
class BorderValue {
friend class RenderStyle;
public:
BorderValue()
: m_width(3)
, m_color(0)
, m_colorIsValid(false)
, m_style(BNONE)
, m_isAuto(AUTO_OFF)
{
}
bool nonZero(bool checkStyle = true) const
{
return width() && (!checkStyle || m_style != BNONE);
}
bool isTransparent() const
{
return m_colorIsValid && !alphaChannel(m_color);
}
bool isVisible(bool checkStyle = true) const
{
return nonZero(checkStyle) && !isTransparent() && (!checkStyle || m_style != BHIDDEN);
}
bool operator==(const BorderValue& o) const
{
return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_colorIsValid == o.m_colorIsValid;
}
bool operator!=(const BorderValue& o) const
{
return !(*this == o);
}
void setColor(const Color& color)
{
m_color = color.rgb();
m_colorIsValid = color.isValid();
}
Color color() const { return Color(m_color, m_colorIsValid); }
float width() const { return m_width; }
EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
protected:
float m_width;
RGBA32 m_color;
unsigned m_colorIsValid : 1;
unsigned m_style : 4;
unsigned m_isAuto : 1; };
}
#endif // BorderValue_h