#ifndef SVGImage_h
#define SVGImage_h
#include "Image.h"
#include "URL.h"
namespace WebCore {
class Element;
class FrameView;
class ImageBuffer;
class Page;
class RenderBox;
class SVGImageChromeClient;
class SVGImageForContainer;
class SVGImage final : public Image {
public:
static PassRefPtr<SVGImage> create(ImageObserver* observer)
{
return adoptRef(new SVGImage(observer));
}
RenderBox* embeddedContentBox() const;
FrameView* frameView() const;
virtual bool isSVGImage() const override { return true; }
virtual FloatSize size() const override { return m_intrinsicSize; }
void setURL(const URL& url) { m_url = url; }
virtual bool hasSingleSecurityOrigin() const override;
virtual bool hasRelativeWidth() const override;
virtual bool hasRelativeHeight() const override;
virtual void startAnimation(CatchUpAnimation = CatchUp) override;
virtual void stopAnimation() override;
virtual void resetAnimation() override;
#if USE(CAIRO)
virtual PassNativeImagePtr nativeImageForCurrentFrame() override;
#endif
private:
friend class SVGImageChromeClient;
friend class SVGImageForContainer;
virtual ~SVGImage();
virtual String filenameExtension() const override;
virtual void setContainerSize(const FloatSize&) override;
IntSize containerSize() const;
virtual bool usesContainerSize() const override { return true; }
virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
virtual bool dataChanged(bool allDataReceived) override;
virtual void destroyDecodedData(bool) override { }
virtual bool currentFrameKnownToBeOpaque() override { return false; }
SVGImage(ImageObserver*);
virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, ImageOrientationDescription) override;
void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatRect&, ColorSpace, CompositeOperator, BlendMode);
void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const AffineTransform&, const FloatPoint&, ColorSpace,
CompositeOperator, const FloatRect&, BlendMode);
std::unique_ptr<SVGImageChromeClient> m_chromeClient;
std::unique_ptr<Page> m_page;
FloatSize m_intrinsicSize;
URL m_url;
};
bool isInSVGImage(const Element*);
IMAGE_TYPE_CASTS(SVGImage)
}
#endif // SVGImage_h