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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 class CanvasRenderingContext; | 57 class CanvasRenderingContext; |
58 class CanvasRenderingContextFactory; | 58 class CanvasRenderingContextFactory; |
59 class GraphicsContext; | 59 class GraphicsContext; |
60 class HTMLCanvasElement; | 60 class HTMLCanvasElement; |
61 class Image; | 61 class Image; |
62 class ImageBitmapOptions; | 62 class ImageBitmapOptions; |
63 class ImageBuffer; | 63 class ImageBuffer; |
64 class ImageBufferSurface; | 64 class ImageBufferSurface; |
65 class ImageData; | 65 class ImageData; |
66 class IntSize; | 66 class IntSize; |
| 67 class WebGraphicsContext3DProvider; |
67 | 68 |
68 class CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrI
mageBitmapRenderingContext; | 69 class CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrI
mageBitmapRenderingContext; |
69 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO
rImageBitmapRenderingContext RenderingContext; | 70 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO
rImageBitmapRenderingContext RenderingContext; |
70 | 71 |
71 class CORE_EXPORT HTMLCanvasElement final : public HTMLElement, public ContextLi
fecycleObserver, public PageVisibilityObserver, public CanvasImageSource, public
ImageBufferClient, public ImageBitmapSource { | 72 class CORE_EXPORT HTMLCanvasElement final : public HTMLElement, public ContextLi
fecycleObserver, public PageVisibilityObserver, public CanvasImageSource, public
ImageBufferClient, public ImageBitmapSource { |
72 DEFINE_WRAPPERTYPEINFO(); | 73 DEFINE_WRAPPERTYPEINFO(); |
73 USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); | 74 USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); |
74 USING_PRE_FINALIZER(HTMLCanvasElement, dispose); | 75 USING_PRE_FINALIZER(HTMLCanvasElement, dispose); |
75 public: | 76 public: |
76 using Node::getExecutionContext; | 77 using Node::getExecutionContext; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void setOriginTainted() { m_originClean = false; } | 141 void setOriginTainted() { m_originClean = false; } |
141 | 142 |
142 AffineTransform baseTransform() const; | 143 AffineTransform baseTransform() const; |
143 | 144 |
144 bool is3D() const; | 145 bool is3D() const; |
145 bool isAnimated2D() const; | 146 bool isAnimated2D() const; |
146 | 147 |
147 bool hasImageBuffer() const { return m_imageBuffer.get(); } | 148 bool hasImageBuffer() const { return m_imageBuffer.get(); } |
148 void discardImageBuffer(); | 149 void discardImageBuffer(); |
149 | 150 |
150 bool shouldAccelerate(const IntSize&) const; | |
151 | |
152 bool shouldBeDirectComposited() const; | 151 bool shouldBeDirectComposited() const; |
153 | 152 |
154 void prepareSurfaceForPaintingIfNeeded() const; | 153 void prepareSurfaceForPaintingIfNeeded() const; |
155 | 154 |
156 const AtomicString imageSourceURL() const override; | 155 const AtomicString imageSourceURL() const override; |
157 | 156 |
158 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 157 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
159 | 158 |
160 // ContextLifecycleObserver (and PageVisibilityObserver!!!) implementation | 159 // ContextLifecycleObserver (and PageVisibilityObserver!!!) implementation |
161 void contextDestroyed() override; | 160 void contextDestroyed() override; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 void didMoveToNewDocument(Document& oldDocument) override; | 212 void didMoveToNewDocument(Document& oldDocument) override; |
214 | 213 |
215 private: | 214 private: |
216 explicit HTMLCanvasElement(Document&); | 215 explicit HTMLCanvasElement(Document&); |
217 void dispose(); | 216 void dispose(); |
218 | 217 |
219 using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFa
ctory>>; | 218 using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFa
ctory>>; |
220 static ContextFactoryVector& renderingContextFactories(); | 219 static ContextFactoryVector& renderingContextFactories(); |
221 static CanvasRenderingContextFactory* getRenderingContextFactory(int); | 220 static CanvasRenderingContextFactory* getRenderingContextFactory(int); |
222 | 221 |
| 222 bool shouldAccelerate(const IntSize&, const WebGraphicsContext3DProvider* sh
aredMainThreadContextProvider) const; |
| 223 |
223 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS
tring&) override; | 224 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS
tring&) override; |
224 LayoutObject* createLayoutObject(const ComputedStyle&) override; | 225 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
225 bool areAuthorShadowsAllowed() const override { return false; } | 226 bool areAuthorShadowsAllowed() const override { return false; } |
226 | 227 |
227 void reset(); | 228 void reset(); |
228 | 229 |
229 std::unique_ptr<ImageBufferSurface> createImageBufferSurface(const IntSize&
deviceSize, int* msaaSampleCount); | 230 std::unique_ptr<ImageBufferSurface> createImageBufferSurface(const IntSize&
deviceSize, int* msaaSampleCount); |
230 void createImageBuffer(); | 231 void createImageBuffer(); |
231 void createImageBufferInternal(std::unique_ptr<ImageBufferSurface> externalS
urface); | 232 void createImageBufferInternal(std::unique_ptr<ImageBufferSurface> externalS
urface); |
232 bool shouldUseDisplayList(const IntSize& deviceSize); | 233 bool shouldUseDisplayList(const IntSize& deviceSize); |
(...skipping 30 matching lines...) Expand all Loading... |
263 // Used for OffscreenCanvas that controls this HTML canvas element | 264 // Used for OffscreenCanvas that controls this HTML canvas element |
264 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; | 265 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; |
265 | 266 |
266 int m_numFramesSinceLastRenderingModeSwitch; | 267 int m_numFramesSinceLastRenderingModeSwitch; |
267 bool m_pendingRenderingModeSwitch; | 268 bool m_pendingRenderingModeSwitch; |
268 }; | 269 }; |
269 | 270 |
270 } // namespace blink | 271 } // namespace blink |
271 | 272 |
272 #endif // HTMLCanvasElement_h | 273 #endif // HTMLCanvasElement_h |
OLD | NEW |