summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/graphics/SVGImage.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/svg/graphics/SVGImage.h')
-rw-r--r--Source/WebCore/svg/graphics/SVGImage.h72
1 files changed, 39 insertions, 33 deletions
diff --git a/Source/WebCore/svg/graphics/SVGImage.h b/Source/WebCore/svg/graphics/SVGImage.h
index 62f9f1d6a..13f9ed87e 100644
--- a/Source/WebCore/svg/graphics/SVGImage.h
+++ b/Source/WebCore/svg/graphics/SVGImage.h
@@ -24,12 +24,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SVGImage_h
-#define SVGImage_h
-
-#if ENABLE(SVG)
+#pragma once
#include "Image.h"
+#include "URL.h"
namespace WebCore {
@@ -38,33 +36,39 @@ class FrameView;
class ImageBuffer;
class Page;
class RenderBox;
+class SVGSVGElement;
class SVGImageChromeClient;
class SVGImageForContainer;
class SVGImage final : public Image {
public:
- static PassRefPtr<SVGImage> create(ImageObserver* observer)
+ static Ref<SVGImage> create(ImageObserver& observer, const URL& url)
{
- return adoptRef(new SVGImage(observer));
+ return adoptRef(*new SVGImage(observer, url));
}
RenderBox* embeddedContentBox() const;
FrameView* frameView() const;
- virtual bool isSVGImage() const override { return true; }
- virtual IntSize size() const override { return m_intrinsicSize; }
+ bool isSVGImage() const final { return true; }
+ FloatSize size() const final { return m_intrinsicSize; }
+
+ void setURL(const URL& url) { m_url = url; }
- virtual bool hasSingleSecurityOrigin() const override;
+ bool hasSingleSecurityOrigin() const final;
- virtual bool hasRelativeWidth() const override;
- virtual bool hasRelativeHeight() const override;
+ bool hasRelativeWidth() const final;
+ bool hasRelativeHeight() const final;
- virtual void startAnimation(bool /*catchUpIfNecessary*/ = true) override;
- virtual void stopAnimation() override;
- virtual void resetAnimation() override;
+ void startAnimation() final;
+ void stopAnimation() final;
+ void resetAnimation() final;
#if USE(CAIRO)
- virtual PassNativeImagePtr nativeImageForCurrentFrame() override;
+ NativeImagePtr nativeImageForCurrentFrame(const GraphicsContext* = nullptr) final;
+#endif
+#if USE(DIRECT2D)
+ NativeImagePtr nativeImage(const GraphicsContext* = nullptr) final;
#endif
private:
@@ -73,38 +77,40 @@ private:
virtual ~SVGImage();
- virtual String filenameExtension() const override;
+ String filenameExtension() const final;
- virtual void setContainerSize(const IntSize&) override;
+ void setContainerSize(const FloatSize&) final;
IntSize containerSize() const;
- virtual bool usesContainerSize() const override { return true; }
- virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
+ bool usesContainerSize() const final { return true; }
+ void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) final;
- virtual bool dataChanged(bool allDataReceived) override;
+ void reportApproximateMemoryCost() const;
+ bool dataChanged(bool allDataReceived) final;
// FIXME: SVGImages will be unable to prune because this function is not implemented yet.
- virtual void destroyDecodedData(bool) override { }
+ void destroyDecodedData(bool) final { }
// FIXME: Implement this to be less conservative.
- virtual bool currentFrameKnownToBeOpaque() override { return false; }
+ bool currentFrameKnownToBeOpaque() const final { return false; }
+
+ void dump(TextStream&) const final;
- 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,
+ SVGImage(ImageObserver&, const URL&);
+ void draw(GraphicsContext&, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator, BlendMode, ImageOrientationDescription) final;
+ void drawForContainer(GraphicsContext&, const FloatSize, float, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode);
+ void drawPatternForContainer(GraphicsContext&, const FloatSize& containerSize, float zoom, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing,
CompositeOperator, const FloatRect&, BlendMode);
+ SVGSVGElement* rootElement() const;
+
std::unique_ptr<SVGImageChromeClient> m_chromeClient;
std::unique_ptr<Page> m_page;
- IntSize m_intrinsicSize;
+ FloatSize m_intrinsicSize;
+ URL m_url;
};
bool isInSVGImage(const Element*);
-IMAGE_TYPE_CASTS(SVGImage)
-
-}
-
+} // namespace WebCore
-#endif // ENABLE(SVG)
-#endif // SVGImage_h
+SPECIALIZE_TYPE_TRAITS_IMAGE(SVGImage)