This source file includes following definitions.
- m_uri
- customCSSText
- m_uri
- cloneForCSSOM
- equals
- colorFromRGBColorString
#include "config.h"
#include "core/svg/SVGPaint.h"
#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "core/css/RGBColor.h"
#include "core/css/parser/BisonCSSParser.h"
namespace WebCore {
SVGPaint::SVGPaint(const SVGPaintType& paintType, const String& uri)
: CSSValue(SVGPaintClass)
, m_paintType(paintType)
, m_uri(uri)
{
}
String SVGPaint::customCSSText() const
{
switch (m_paintType) {
case SVG_PAINTTYPE_UNKNOWN:
return String();
case SVG_PAINTTYPE_RGBCOLOR:
case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR:
return m_color.serializedAsCSSComponentValue();
case SVG_PAINTTYPE_CURRENTCOLOR:
return "currentColor";
case SVG_PAINTTYPE_NONE:
return "none";
case SVG_PAINTTYPE_URI_NONE:
return m_uri + " none";
case SVG_PAINTTYPE_URI_CURRENTCOLOR:
return "url(" + m_uri + ") currentColor";
case SVG_PAINTTYPE_URI_RGBCOLOR:
case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: {
return "url(" + m_uri + ") " + m_color.serializedAsCSSComponentValue();
}
case SVG_PAINTTYPE_URI:
return "url(" + m_uri + ')';
};
ASSERT_NOT_REACHED();
return String();
}
SVGPaint::SVGPaint(const SVGPaint& cloneFrom)
: CSSValue(SVGPaintClass, true)
, m_paintType(cloneFrom.m_paintType)
, m_color(cloneFrom.m_color)
, m_uri(cloneFrom.m_uri)
{
}
PassRefPtrWillBeRawPtr<SVGPaint> SVGPaint::cloneForCSSOM() const
{
return adoptRefWillBeRefCountedGarbageCollected(new SVGPaint(*this));
}
bool SVGPaint::equals(const SVGPaint& other) const
{
return m_paintType == other.m_paintType && m_uri == other.m_uri && m_color == other.m_color;
}
StyleColor SVGPaint::colorFromRGBColorString(const String& colorString)
{
RGBA32 color;
if (BisonCSSParser::parseColor(color, colorString.stripWhiteSpace()))
return StyleColor(color);
return StyleColor::currentColor();
}
}