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 11 matching lines...) Expand all Loading... |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef SVGImage_h | 27 #ifndef SVGImage_h |
28 #define SVGImage_h | 28 #define SVGImage_h |
29 | 29 |
30 #include "platform/graphics/Image.h" | 30 #include "platform/graphics/Image.h" |
31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
| 32 #include "platform/weborigin/KURL.h" |
32 | 33 |
33 namespace WebCore { | 34 namespace WebCore { |
34 | 35 |
35 class Element; | 36 class Element; |
36 class FrameView; | 37 class FrameView; |
37 class ImageBuffer; | 38 class ImageBuffer; |
38 class Page; | 39 class Page; |
39 class RenderBox; | 40 class RenderBox; |
40 class SVGImageChromeClient; | 41 class SVGImageChromeClient; |
41 class SVGImageForContainer; | 42 class SVGImageForContainer; |
42 | 43 |
43 class SVGImage FINAL : public Image { | 44 class SVGImage FINAL : public Image { |
44 public: | 45 public: |
45 static PassRefPtr<SVGImage> create(ImageObserver* observer) | 46 static PassRefPtr<SVGImage> create(ImageObserver* observer) |
46 { | 47 { |
47 return adoptRef(new SVGImage(observer)); | 48 return adoptRef(new SVGImage(observer)); |
48 } | 49 } |
49 | 50 |
50 static bool isInSVGImage(const Node*); | 51 static bool isInSVGImage(const Node*); |
51 | 52 |
52 RenderBox* embeddedContentBox() const; | 53 RenderBox* embeddedContentBox() const; |
53 | 54 |
54 virtual bool isSVGImage() const OVERRIDE { return true; } | 55 virtual bool isSVGImage() const OVERRIDE { return true; } |
55 virtual IntSize size() const OVERRIDE { return m_intrinsicSize; } | 56 virtual IntSize size() const OVERRIDE { return m_intrinsicSize; } |
| 57 void setURL(const KURL& url) { m_url = url; } |
56 | 58 |
57 virtual bool currentFrameHasSingleSecurityOrigin() const OVERRIDE; | 59 virtual bool currentFrameHasSingleSecurityOrigin() const OVERRIDE; |
58 | 60 |
59 virtual void startAnimation(CatchUpAnimation = CatchUp) OVERRIDE; | 61 virtual void startAnimation(CatchUpAnimation = CatchUp) OVERRIDE; |
60 virtual void stopAnimation() OVERRIDE; | 62 virtual void stopAnimation() OVERRIDE; |
61 virtual void resetAnimation() OVERRIDE; | 63 virtual void resetAnimation() OVERRIDE; |
62 | 64 |
63 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE; | 65 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE; |
64 | 66 |
65 // Returns the SVG image document's frame. | 67 // Returns the SVG image document's frame. |
(...skipping 28 matching lines...) Expand all Loading... |
94 | 96 |
95 SVGImage(ImageObserver*); | 97 SVGImage(ImageObserver*); |
96 virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRe
ct& toRect, CompositeOperator, blink::WebBlendMode) OVERRIDE; | 98 virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRe
ct& toRect, CompositeOperator, blink::WebBlendMode) OVERRIDE; |
97 void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatR
ect&, const FloatRect&, CompositeOperator, blink::WebBlendMode); | 99 void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatR
ect&, const FloatRect&, CompositeOperator, blink::WebBlendMode); |
98 void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const
FloatRect&, const FloatSize&, const FloatPoint&, | 100 void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const
FloatRect&, const FloatSize&, const FloatPoint&, |
99 CompositeOperator, const FloatRect&, blink::WebBlendMode, const IntSize&
repeatSpacing); | 101 CompositeOperator, const FloatRect&, blink::WebBlendMode, const IntSize&
repeatSpacing); |
100 | 102 |
101 OwnPtr<SVGImageChromeClient> m_chromeClient; | 103 OwnPtr<SVGImageChromeClient> m_chromeClient; |
102 OwnPtrWillBePersistent<Page> m_page; | 104 OwnPtrWillBePersistent<Page> m_page; |
103 IntSize m_intrinsicSize; | 105 IntSize m_intrinsicSize; |
| 106 KURL m_url; |
104 }; | 107 }; |
105 | 108 |
106 DEFINE_IMAGE_TYPE_CASTS(SVGImage); | 109 DEFINE_IMAGE_TYPE_CASTS(SVGImage); |
107 | 110 |
108 class ImageObserverDisabler { | 111 class ImageObserverDisabler { |
109 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); | 112 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); |
110 public: | 113 public: |
111 ImageObserverDisabler(Image* image) | 114 ImageObserverDisabler(Image* image) |
112 : m_image(image) | 115 : m_image(image) |
113 { | 116 { |
114 ASSERT(m_image->imageObserver()); | 117 ASSERT(m_image->imageObserver()); |
115 m_observer = m_image->imageObserver(); | 118 m_observer = m_image->imageObserver(); |
116 m_image->setImageObserver(0); | 119 m_image->setImageObserver(0); |
117 } | 120 } |
118 | 121 |
119 ~ImageObserverDisabler() | 122 ~ImageObserverDisabler() |
120 { | 123 { |
121 m_image->setImageObserver(m_observer); | 124 m_image->setImageObserver(m_observer); |
122 } | 125 } |
123 private: | 126 private: |
124 Image* m_image; | 127 Image* m_image; |
125 ImageObserver* m_observer; | 128 ImageObserver* m_observer; |
126 }; | 129 }; |
127 | 130 |
128 } | 131 } |
129 | 132 |
130 #endif // SVGImage_h | 133 #endif // SVGImage_h |
OLD | NEW |