#ifndef StyleFetchedImageSet_h
#define StyleFetchedImageSet_h
#include "core/fetch/ImageResourceClient.h"
#include "core/fetch/ResourcePtr.h"
#include "core/rendering/style/StyleImage.h"
#include "platform/geometry/LayoutSize.h"
namespace WebCore {
class ImageResource;
class CSSImageSetValue;
class StyleFetchedImageSet FINAL : public StyleImage, private ImageResourceClient {
WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<StyleFetchedImageSet> create(ImageResource* image, float imageScaleFactor, CSSImageSetValue* value)
{
return adoptRef(new StyleFetchedImageSet(image, imageScaleFactor, value));
}
virtual ~StyleFetchedImageSet();
virtual PassRefPtrWillBeRawPtr<CSSValue> cssValue() const OVERRIDE;
virtual WrappedImagePtr data() const OVERRIDE { return m_bestFitImage.get(); }
void clearImageSetValue() { m_imageSetValue = 0; }
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 float imageScaleFactor() const OVERRIDE { return m_imageScaleFactor; }
virtual bool knownToBeOpaque(const RenderObject*) const OVERRIDE;
virtual ImageResource* cachedImage() const OVERRIDE { return m_bestFitImage.get(); }
private:
StyleFetchedImageSet(ImageResource*, float imageScaleFactor, CSSImageSetValue*);
ResourcePtr<ImageResource> m_bestFitImage;
float m_imageScaleFactor;
CSSImageSetValue* m_imageSetValue;
};
DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleFetchedImageSet, isImageResourceSet());
}
#endif