OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 public: | 61 public: |
62 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect)
= 0; | 62 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect)
= 0; |
63 virtual void canvasResized(HTMLCanvasElement*) = 0; | 63 virtual void canvasResized(HTMLCanvasElement*) = 0; |
64 #if !ENABLE(OILPAN) | 64 #if !ENABLE(OILPAN) |
65 virtual void canvasDestroyed(HTMLCanvasElement*) = 0; | 65 virtual void canvasDestroyed(HTMLCanvasElement*) = 0; |
66 #endif | 66 #endif |
67 | 67 |
68 virtual void trace(Visitor*) { } | 68 virtual void trace(Visitor*) { } |
69 }; | 69 }; |
70 | 70 |
71 class HTMLCanvasElement FINAL : public HTMLElement, public DocumentVisibilityObs
erver, public CanvasImageSource, public ImageBufferClient, public blink::WebThre
ad::TaskObserver { | 71 class HTMLCanvasElement final : public HTMLElement, public DocumentVisibilityObs
erver, public CanvasImageSource, public ImageBufferClient, public blink::WebThre
ad::TaskObserver { |
72 DEFINE_WRAPPERTYPEINFO(); | 72 DEFINE_WRAPPERTYPEINFO(); |
73 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); | 73 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); |
74 public: | 74 public: |
75 DECLARE_NODE_FACTORY(HTMLCanvasElement); | 75 DECLARE_NODE_FACTORY(HTMLCanvasElement); |
76 virtual ~HTMLCanvasElement(); | 76 virtual ~HTMLCanvasElement(); |
77 | 77 |
78 void addObserver(CanvasObserver*); | 78 void addObserver(CanvasObserver*); |
79 void removeObserver(CanvasObserver*); | 79 void removeObserver(CanvasObserver*); |
80 | 80 |
81 // Attributes and functions exposed to script | 81 // Attributes and functions exposed to script |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 AffineTransform baseTransform() const; | 132 AffineTransform baseTransform() const; |
133 | 133 |
134 bool is3D() const; | 134 bool is3D() const; |
135 | 135 |
136 bool hasImageBuffer() const { return m_imageBuffer; } | 136 bool hasImageBuffer() const { return m_imageBuffer; } |
137 bool hasValidImageBuffer() const; | 137 bool hasValidImageBuffer() const; |
138 void discardImageBuffer(); | 138 void discardImageBuffer(); |
139 | 139 |
140 bool shouldAccelerate(const IntSize&) const; | 140 bool shouldAccelerate(const IntSize&) const; |
141 | 141 |
142 virtual const AtomicString imageSourceURL() const OVERRIDE; | 142 virtual const AtomicString imageSourceURL() const override; |
143 | 143 |
144 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 144 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; |
145 | 145 |
146 // DocumentVisibilityObserver implementation | 146 // DocumentVisibilityObserver implementation |
147 virtual void didChangeVisibilityState(PageVisibilityState) OVERRIDE; | 147 virtual void didChangeVisibilityState(PageVisibilityState) override; |
148 | 148 |
149 // CanvasImageSource implementation | 149 // CanvasImageSource implementation |
150 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma
geStatus*) const OVERRIDE; | 150 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma
geStatus*) const override; |
151 virtual bool wouldTaintOrigin(SecurityOrigin*) const OVERRIDE; | 151 virtual bool wouldTaintOrigin(SecurityOrigin*) const override; |
152 virtual FloatSize sourceSize() const OVERRIDE; | 152 virtual FloatSize sourceSize() const override; |
153 | 153 |
154 // ImageBufferClient implementation | 154 // ImageBufferClient implementation |
155 virtual void notifySurfaceInvalid() OVERRIDE; | 155 virtual void notifySurfaceInvalid() override; |
156 virtual bool isDirty() OVERRIDE { return !m_dirtyRect.isEmpty(); } | 156 virtual bool isDirty() override { return !m_dirtyRect.isEmpty(); } |
157 virtual void didFinalizeFrame() OVERRIDE; | 157 virtual void didFinalizeFrame() override; |
158 | 158 |
159 // Implementation of WebThread::TaskObserver methods | 159 // Implementation of WebThread::TaskObserver methods |
160 virtual void willProcessTask() OVERRIDE; | 160 virtual void willProcessTask() override; |
161 virtual void didProcessTask() OVERRIDE; | 161 virtual void didProcessTask() override; |
162 | 162 |
163 virtual void trace(Visitor*) OVERRIDE; | 163 virtual void trace(Visitor*) override; |
164 | 164 |
165 protected: | 165 protected: |
166 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; | 166 virtual void didMoveToNewDocument(Document& oldDocument) override; |
167 | 167 |
168 private: | 168 private: |
169 explicit HTMLCanvasElement(Document&); | 169 explicit HTMLCanvasElement(Document&); |
170 | 170 |
171 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 171 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; |
172 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; | 172 virtual RenderObject* createRenderer(RenderStyle*) override; |
173 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } | 173 virtual bool areAuthorShadowsAllowed() const override { return false; } |
174 | 174 |
175 void reset(); | 175 void reset(); |
176 | 176 |
177 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic
eSize, int* msaaSampleCount); | 177 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic
eSize, int* msaaSampleCount); |
178 void createImageBuffer(); | 178 void createImageBuffer(); |
179 void createImageBufferInternal(); | 179 void createImageBufferInternal(); |
180 void clearImageBuffer(); | 180 void clearImageBuffer(); |
181 | 181 |
182 void resetDirtyRect(); | 182 void resetDirtyRect(); |
183 | 183 |
(...skipping 26 matching lines...) Expand all Loading... |
210 OwnPtr<ImageBuffer> m_imageBuffer; | 210 OwnPtr<ImageBuffer> m_imageBuffer; |
211 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; | 211 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; |
212 | 212 |
213 mutable RefPtr<Image> m_presentedImage; | 213 mutable RefPtr<Image> m_presentedImage; |
214 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 214 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). |
215 }; | 215 }; |
216 | 216 |
217 } // namespace blink | 217 } // namespace blink |
218 | 218 |
219 #endif // HTMLCanvasElement_h | 219 #endif // HTMLCanvasElement_h |
OLD | NEW |