#ifndef StyleFetchedImage_h
#define StyleFetchedImage_h
#include "core/fetch/ImageResourceClient.h"
#include "core/fetch/ResourcePtr.h"
#include "core/rendering/style/StyleImage.h"
namespace WebCore {
class ImageResource;
class StyleFetchedImage FINAL : public StyleImage, private ImageResourceClient {
WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<StyleFetchedImage> create(ImageResource* image) { return adoptRef(new StyleFetchedImage(image)); }
virtual ~StyleFetchedImage();
virtual WrappedImagePtr data() const OVERRIDE { return m_image.get(); }
virtual PassRefPtrWillBeRawPtr<CSSValue> cssValue() const OVERRIDE;
virtual bool canRender(const RenderObject*, float multiplier) const OVERRIDE;
virtual bool isLoaded() const OVERRIDE;
virtual bool errorOccurred() const OVERRIDE;
virtual LayoutSize imageSize(const RenderObject*, float multiplier) const OVERRIDE;
virtual bool imageHasRelativeWidth() const OVERRIDE;
virtual bool imageHasRelativeHeight() const OVERRIDE;
virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) OVERRIDE;
virtual bool usesImageContainerSize() const OVERRIDE;
virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float) OVERRIDE;
virtual void addClient(RenderObject*) OVERRIDE;
virtual void removeClient(RenderObject*) OVERRIDE;
virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const OVERRIDE;
virtual bool knownToBeOpaque(const RenderObject*) const OVERRIDE;
virtual ImageResource* cachedImage() const OVERRIDE { return m_image.get(); }
private:
explicit StyleFetchedImage(ImageResource*);
ResourcePtr<ImageResource> m_image;
};
DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImage, isImageResource());
}
#endif