| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
| 3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 public: | 45 public: |
| 46 static PassRefPtr<SVGImage> create(ImageObserver* observer) | 46 static PassRefPtr<SVGImage> create(ImageObserver* observer) |
| 47 { | 47 { |
| 48 return adoptRef(new SVGImage(observer)); | 48 return adoptRef(new SVGImage(observer)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 static bool isInSVGImage(const Node*); | 51 static bool isInSVGImage(const Node*); |
| 52 | 52 |
| 53 LayoutBox* embeddedContentBox() const; | 53 LayoutBox* embeddedContentBox() const; |
| 54 | 54 |
| 55 virtual bool isSVGImage() const override { return true; } | 55 bool isSVGImage() const override { return true; } |
| 56 virtual IntSize size() const override { return m_intrinsicSize; } | 56 IntSize size() const override { return m_intrinsicSize; } |
| 57 void setURL(const KURL& url) { m_url = url; } | 57 void setURL(const KURL& url) { m_url = url; } |
| 58 | 58 |
| 59 virtual bool currentFrameHasSingleSecurityOrigin() const override; | 59 bool currentFrameHasSingleSecurityOrigin() const override; |
| 60 | 60 |
| 61 virtual void startAnimation(CatchUpAnimation = CatchUp) override; | 61 void startAnimation(CatchUpAnimation = CatchUp) override; |
| 62 virtual void stopAnimation() override; | 62 void stopAnimation() override; |
| 63 virtual void resetAnimation() override; | 63 void resetAnimation() override; |
| 64 | 64 |
| 65 virtual bool bitmapForCurrentFrame(SkBitmap*) override; | 65 bool bitmapForCurrentFrame(SkBitmap*) override; |
| 66 | 66 |
| 67 // Returns the SVG image document's frame. | 67 // Returns the SVG image document's frame. |
| 68 FrameView* frameView() const; | 68 FrameView* frameView() const; |
| 69 | 69 |
| 70 // Does the SVG image/document contain any animations? | 70 // Does the SVG image/document contain any animations? |
| 71 bool hasAnimations() const; | 71 bool hasAnimations() const; |
| 72 | 72 |
| 73 void updateUseCounters(Document&) const; | 73 void updateUseCounters(Document&) const; |
| 74 | 74 |
| 75 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } | 75 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } |
| 76 String debugName() const { return "SVGImage"; } | 76 String debugName() const { return "SVGImage"; } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 friend class AXLayoutObject; | 79 friend class AXLayoutObject; |
| 80 friend class SVGImageChromeClient; | 80 friend class SVGImageChromeClient; |
| 81 friend class SVGImageForContainer; | 81 friend class SVGImageForContainer; |
| 82 | 82 |
| 83 virtual ~SVGImage(); | 83 virtual ~SVGImage(); |
| 84 | 84 |
| 85 | 85 |
| 86 virtual String filenameExtension() const override; | 86 String filenameExtension() const override; |
| 87 | 87 |
| 88 virtual void setContainerSize(const IntSize&) override; | 88 void setContainerSize(const IntSize&) override; |
| 89 IntSize containerSize() const; | 89 IntSize containerSize() const; |
| 90 virtual bool usesContainerSize() const override { return true; } | 90 bool usesContainerSize() const override { return true; } |
| 91 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr
insicHeight, FloatSize& intrinsicRatio) override; | 91 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei
ght, FloatSize& intrinsicRatio) override; |
| 92 | 92 |
| 93 virtual bool dataChanged(bool allDataReceived) override; | 93 bool dataChanged(bool allDataReceived) override; |
| 94 | 94 |
| 95 // FIXME: SVGImages are underreporting decoded sizes and will be unable | 95 // FIXME: SVGImages are underreporting decoded sizes and will be unable |
| 96 // to prune because these functions are not implemented yet. | 96 // to prune because these functions are not implemented yet. |
| 97 virtual void destroyDecodedData(bool) override { } | 97 void destroyDecodedData(bool) override { } |
| 98 | 98 |
| 99 // FIXME: Implement this to be less conservative. | 99 // FIXME: Implement this to be less conservative. |
| 100 virtual bool currentFrameKnownToBeOpaque() override { return false; } | 100 bool currentFrameKnownToBeOpaque() override { return false; } |
| 101 | 101 |
| 102 SVGImage(ImageObserver*); | 102 SVGImage(ImageObserver*); |
| 103 void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRe
ct, SkXfermode::Mode, RespectImageOrientationEnum) override; | 103 void draw(SkCanvas*, const SkPaint&, const FloatRect& fromRect, const FloatR
ect& toRect, RespectImageOrientationEnum, bool shouldClampToSourceRect) override
; |
| 104 void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatR
ect&, const FloatRect&, SkXfermode::Mode); | 104 void drawForContainer(SkCanvas*, const SkPaint&, const FloatSize, float, con
st FloatRect&, const FloatRect&); |
| 105 void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const
FloatRect&, const FloatSize&, const FloatPoint&, | 105 void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const
FloatRect&, const FloatSize&, const FloatPoint&, |
| 106 SkXfermode::Mode, const FloatRect&, const IntSize& repeatSpacing); | 106 SkXfermode::Mode, const FloatRect&, const IntSize& repeatSpacing); |
| 107 | 107 |
| 108 OwnPtr<SVGImageChromeClient> m_chromeClient; | 108 OwnPtr<SVGImageChromeClient> m_chromeClient; |
| 109 OwnPtrWillBePersistent<Page> m_page; | 109 OwnPtrWillBePersistent<Page> m_page; |
| 110 IntSize m_intrinsicSize; | 110 IntSize m_intrinsicSize; |
| 111 KURL m_url; | 111 KURL m_url; |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 DEFINE_IMAGE_TYPE_CASTS(SVGImage); | 114 DEFINE_IMAGE_TYPE_CASTS(SVGImage); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 128 m_image->setImageObserver(m_observer); | 128 m_image->setImageObserver(m_observer); |
| 129 } | 129 } |
| 130 private: | 130 private: |
| 131 Image* m_image; | 131 Image* m_image; |
| 132 ImageObserver* m_observer; | 132 ImageObserver* m_observer; |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 } | 135 } |
| 136 | 136 |
| 137 #endif // SVGImage_h | 137 #endif // SVGImage_h |
| OLD | NEW |