StyleCachedImage.h [plain text]
#pragma once
#include "CachedImageClient.h"
#include "CachedResourceHandle.h"
#include "StyleImage.h"
namespace WebCore {
class CSSValue;
class CachedImage;
class Document;
class StyleCachedImage final : public StyleImage {
WTF_MAKE_FAST_ALLOCATED;
public:
static Ref<StyleCachedImage> create(CSSValue& cssValue) { return adoptRef(*new StyleCachedImage(cssValue)); }
virtual ~StyleCachedImage();
bool operator==(const StyleImage& other) const override;
CachedImage* cachedImage() const override;
WrappedImagePtr data() const override { return m_cachedImage.get(); }
Ref<CSSValue> cssValue() const override;
bool canRender(const RenderElement*, float multiplier) const override;
bool isPending() const override;
void load(CachedResourceLoader&, const ResourceLoaderOptions&) override;
bool isLoaded() const override;
bool errorOccurred() const override;
FloatSize imageSize(const RenderElement*, float multiplier) const override;
bool imageHasRelativeWidth() const override;
bool imageHasRelativeHeight() const override;
void computeIntrinsicDimensions(const RenderElement*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
bool usesImageContainerSize() const override;
void setContainerSizeForRenderer(const RenderElement*, const FloatSize&, float) override;
void addClient(RenderElement*) override;
void removeClient(RenderElement*) override;
RefPtr<Image> image(RenderElement*, const FloatSize&) const override;
float imageScaleFactor() const override;
bool knownToBeOpaque(const RenderElement*) const override;
private:
StyleCachedImage(CSSValue&);
Ref<CSSValue> m_cssValue;
bool m_isPending { true };
mutable float m_scaleFactor { 1 };
mutable CachedResourceHandle<CachedImage> m_cachedImage;
};
}
SPECIALIZE_TYPE_TRAITS_STYLE_IMAGE(StyleCachedImage, isCachedImage)