StylePendingImage.h [plain text]
#ifndef StylePendingImage_h
#define StylePendingImage_h
#include "CSSCursorImageValue.h"
#include "CSSImageGeneratorValue.h"
#include "CSSImageValue.h"
#include "StyleImage.h"
#if ENABLE(CSS_IMAGE_SET)
#include "CSSImageSetValue.h"
#endif
namespace WebCore {
class StylePendingImage final : public StyleImage {
public:
static Ref<StylePendingImage> create(CSSValue* value) { return adoptRef(*new StylePendingImage(value)); }
CSSImageValue* cssImageValue() const { return is<CSSImageValue>(m_value) ? downcast<CSSImageValue>(m_value) : nullptr; }
CSSImageGeneratorValue* cssImageGeneratorValue() const { return is<CSSImageGeneratorValue>(m_value) ? static_cast<CSSImageGeneratorValue*>(m_value) : nullptr; }
CSSCursorImageValue* cssCursorImageValue() const { return is<CSSCursorImageValue>(m_value) ? downcast<CSSCursorImageValue>(m_value) : nullptr; }
#if ENABLE(CSS_IMAGE_SET)
CSSImageSetValue* cssImageSetValue() const { return is<CSSImageSetValue>(m_value) ? downcast<CSSImageSetValue>(m_value) : nullptr; }
#endif
void detachFromCSSValue() { m_value = nullptr; }
private:
WrappedImagePtr data() const override { return const_cast<StylePendingImage*>(this); }
PassRefPtr<CSSValue> cssValue() const override { return m_value; }
FloatSize imageSize(const RenderElement*, float ) const override { return FloatSize(); }
bool imageHasRelativeWidth() const override { return false; }
bool imageHasRelativeHeight() const override { return false; }
void computeIntrinsicDimensions(const RenderElement*, Length& , Length& , FloatSize& ) override { }
bool usesImageContainerSize() const override { return false; }
void setContainerSizeForRenderer(const RenderElement*, const FloatSize&, float) override { }
void addClient(RenderElement*) override { }
void removeClient(RenderElement*) override { }
RefPtr<Image> image(RenderElement*, const FloatSize&) const override
{
ASSERT_NOT_REACHED();
return nullptr;
}
bool knownToBeOpaque(const RenderElement*) const override { return false; }
StylePendingImage(CSSValue* value)
: m_value(value)
{
m_isPendingImage = true;
}
CSSValue* m_value; };
}
SPECIALIZE_TYPE_TRAITS_STYLE_IMAGE(StylePendingImage, isPendingImage)
#endif // StylePendingImage_h