#ifndef CSSImageValue_h
#define CSSImageValue_h
#include "CSSValue.h"
#include <wtf/RefPtr.h>
namespace WebCore {
class CachedResourceLoader;
class Element;
class StyleCachedImage;
class StyleImage;
class RenderElement;
struct ResourceLoaderOptions;
class CSSImageValue : public CSSValue {
public:
static Ref<CSSImageValue> create(const String& url) { return adoptRef(*new CSSImageValue(url)); }
static Ref<CSSImageValue> create(const String& url, StyleImage* image) { return adoptRef(*new CSSImageValue(url, image)); }
~CSSImageValue();
StyleCachedImage* cachedImage(CachedResourceLoader&, const ResourceLoaderOptions&);
StyleImage* cachedOrPendingImage();
const String& url() const { return m_url; }
String customCSSText() const;
PassRefPtr<CSSValue> cloneForCSSOM() const;
bool traverseSubresources(const std::function<bool (const CachedResource&)>& handler) const;
bool equals(const CSSImageValue&) const;
bool knownToBeOpaque(const RenderElement*) const;
void setInitiator(const AtomicString& name) { m_initiatorName = name; }
private:
explicit CSSImageValue(const String& url);
CSSImageValue(const String& url, StyleImage*);
void detachPendingImage();
String m_url;
RefPtr<StyleImage> m_image;
bool m_accessedImage;
AtomicString m_initiatorName;
};
}
SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSImageValue, isImageValue())
#endif // CSSImageValue_h