#ifndef CSSImageValue_h
#define CSSImageValue_h
#include "core/css/CSSValue.h"
#include "core/fetch/ResourceFetcher.h"
#include "wtf/RefPtr.h"
namespace WebCore {
class Document;
class Element;
class KURL;
class StyleFetchedImage;
class StyleImage;
class RenderObject;
class CSSImageValue : public CSSValue {
public:
static PassRefPtrWillBeRawPtr<CSSImageValue> create(const KURL& url, StyleImage* image = 0)
{
return adoptRefWillBeRefCountedGarbageCollected(new CSSImageValue(url, url, image));
}
static PassRefPtrWillBeRawPtr<CSSImageValue> create(const String& rawValue, const KURL& url, StyleImage* image = 0)
{
return adoptRefWillBeRefCountedGarbageCollected(new CSSImageValue(rawValue, url, image));
}
~CSSImageValue();
StyleFetchedImage* cachedImage(ResourceFetcher*, const ResourceLoaderOptions&);
StyleFetchedImage* cachedImage(ResourceFetcher* fetcher) { return cachedImage(fetcher, ResourceFetcher::defaultResourceOptions()); }
StyleImage* cachedOrPendingImage();
const String& url() { return m_absoluteURL; }
void reResolveURL(const Document&);
String customCSSText() const;
PassRefPtrWillBeRawPtr<CSSValue> cloneForCSSOM() const;
bool hasFailedOrCanceledSubresources() const;
bool equals(const CSSImageValue&) const;
bool knownToBeOpaque(const RenderObject*) const;
void setInitiator(const AtomicString& name) { m_initiatorName = name; }
void traceAfterDispatch(Visitor*);
private:
CSSImageValue(const String& rawValue, const KURL&, StyleImage*);
String m_relativeURL;
String m_absoluteURL;
RefPtr<StyleImage> m_image;
bool m_accessedImage;
AtomicString m_initiatorName;
};
DEFINE_CSS_VALUE_TYPE_CASTS(CSSImageValue, isImageValue());
}
#endif