#ifndef CSSFontFaceSrcValue_h
#define CSSFontFaceSrcValue_h
#include "core/css/CSSValue.h"
#include "core/fetch/ResourcePtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class FontResource;
class Document;
class SVGFontFaceElement;
class CSSFontFaceSrcValue : public CSSValue {
public:
static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> create(const String& resource)
{
return adoptRefWillBeRefCountedGarbageCollected(new CSSFontFaceSrcValue(resource, false));
}
static PassRefPtrWillBeRawPtr<CSSFontFaceSrcValue> createLocal(const String& resource)
{
return adoptRefWillBeRefCountedGarbageCollected(new CSSFontFaceSrcValue(resource, true));
}
const String& resource() const { return m_resource; }
const String& format() const { return m_format; }
bool isLocal() const { return m_isLocal; }
void setFormat(const String& format) { m_format = format; }
bool isSupportedFormat() const;
#if ENABLE(SVG_FONTS)
bool isSVGFontFaceSrc() const;
SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
void setSVGFontFaceElement(SVGFontFaceElement* element) { m_svgFontFaceElement = element; }
#endif
String customCSSText() const;
bool hasFailedOrCanceledSubresources() const;
FontResource* fetch(Document*);
bool equals(const CSSFontFaceSrcValue&) const;
void traceAfterDispatch(Visitor* visitor) { CSSValue::traceAfterDispatch(visitor); }
private:
CSSFontFaceSrcValue(const String& resource, bool local)
: CSSValue(FontFaceSrcClass)
, m_resource(resource)
, m_isLocal(local)
#if ENABLE(SVG_FONTS)
, m_svgFontFaceElement(0)
#endif
{
}
String m_resource;
String m_format;
bool m_isLocal;
ResourcePtr<FontResource> m_fetched;
#if ENABLE(SVG_FONTS)
SVGFontFaceElement* m_svgFontFaceElement;
#endif
};
DEFINE_CSS_VALUE_TYPE_CASTS(CSSFontFaceSrcValue, isFontFaceSrcValue());
}
#endif