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 20 matching lines...) Expand all Loading... |
31 #include "bindings/core/v8/ScriptValue.h" | 31 #include "bindings/core/v8/ScriptValue.h" |
32 #include "core/CoreExport.h" | 32 #include "core/CoreExport.h" |
33 #include "core/dom/ContextLifecycleObserver.h" | 33 #include "core/dom/ContextLifecycleObserver.h" |
34 #include "core/dom/DOMTypedArray.h" | 34 #include "core/dom/DOMTypedArray.h" |
35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
36 #include "core/fileapi/BlobCallback.h" | 36 #include "core/fileapi/BlobCallback.h" |
37 #include "core/html/HTMLElement.h" | 37 #include "core/html/HTMLElement.h" |
38 #include "core/html/canvas/CanvasDrawListener.h" | 38 #include "core/html/canvas/CanvasDrawListener.h" |
39 #include "core/html/canvas/CanvasImageSource.h" | 39 #include "core/html/canvas/CanvasImageSource.h" |
40 #include "core/imagebitmap/ImageBitmapSource.h" | 40 #include "core/imagebitmap/ImageBitmapSource.h" |
41 #include "core/page/PageLifecycleObserver.h" | 41 #include "core/page/PageVisibilityObserver.h" |
42 #include "platform/geometry/FloatRect.h" | 42 #include "platform/geometry/FloatRect.h" |
43 #include "platform/geometry/IntSize.h" | 43 #include "platform/geometry/IntSize.h" |
44 #include "platform/graphics/CanvasSurfaceLayerBridge.h" | 44 #include "platform/graphics/CanvasSurfaceLayerBridge.h" |
45 #include "platform/graphics/GraphicsTypes.h" | 45 #include "platform/graphics/GraphicsTypes.h" |
46 #include "platform/graphics/GraphicsTypes3D.h" | 46 #include "platform/graphics/GraphicsTypes3D.h" |
47 #include "platform/graphics/ImageBufferClient.h" | 47 #include "platform/graphics/ImageBufferClient.h" |
48 #include "platform/heap/Handle.h" | 48 #include "platform/heap/Handle.h" |
49 #include <memory> | 49 #include <memory> |
50 | 50 |
51 #define CanvasDefaultInterpolationQuality InterpolationLow | 51 #define CanvasDefaultInterpolationQuality InterpolationLow |
52 | 52 |
53 namespace blink { | 53 namespace blink { |
54 | 54 |
55 class AffineTransform; | 55 class AffineTransform; |
56 class CanvasContextCreationAttributes; | 56 class CanvasContextCreationAttributes; |
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 | 67 |
68 class CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrI
mageBitmapRenderingContext; | 68 class CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrI
mageBitmapRenderingContext; |
69 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO
rImageBitmapRenderingContext RenderingContext; | 69 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO
rImageBitmapRenderingContext RenderingContext; |
70 | 70 |
71 class CORE_EXPORT HTMLCanvasElement final : public HTMLElement, public ContextLi
fecycleObserver, public PageLifecycleObserver, public CanvasImageSource, public
ImageBufferClient, public ImageBitmapSource { | 71 class CORE_EXPORT HTMLCanvasElement final : public HTMLElement, public ContextLi
fecycleObserver, public PageVisibilityObserver, public CanvasImageSource, public
ImageBufferClient, public ImageBitmapSource { |
72 DEFINE_WRAPPERTYPEINFO(); | 72 DEFINE_WRAPPERTYPEINFO(); |
73 USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); | 73 USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); |
74 USING_PRE_FINALIZER(HTMLCanvasElement, dispose); | 74 USING_PRE_FINALIZER(HTMLCanvasElement, dispose); |
75 public: | 75 public: |
76 using Node::getExecutionContext; | 76 using Node::getExecutionContext; |
77 | 77 |
78 DECLARE_NODE_FACTORY(HTMLCanvasElement); | 78 DECLARE_NODE_FACTORY(HTMLCanvasElement); |
79 ~HTMLCanvasElement() override; | 79 ~HTMLCanvasElement() override; |
80 | 80 |
81 // Attributes and functions exposed to script | 81 // Attributes and functions exposed to script |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 bool shouldAccelerate(const IntSize&) const; | 150 bool shouldAccelerate(const IntSize&) const; |
151 | 151 |
152 bool shouldBeDirectComposited() const; | 152 bool shouldBeDirectComposited() const; |
153 | 153 |
154 void prepareSurfaceForPaintingIfNeeded() const; | 154 void prepareSurfaceForPaintingIfNeeded() const; |
155 | 155 |
156 const AtomicString imageSourceURL() const override; | 156 const AtomicString imageSourceURL() const override; |
157 | 157 |
158 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 158 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
159 | 159 |
160 // ContextLifecycleObserver (and PageLifecycleObserver!!!) implementation | 160 // ContextLifecycleObserver (and PageVisibilityObserver!!!) implementation |
161 void contextDestroyed() override; | 161 void contextDestroyed() override; |
162 | 162 |
163 // PageLifecycleObserver implementation | 163 // PageVisibilityObserver implementation |
164 void pageVisibilityChanged() override; | 164 void pageVisibilityChanged() override; |
165 | 165 |
166 // CanvasImageSource implementation | 166 // CanvasImageSource implementation |
167 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; | 167 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; |
168 bool wouldTaintOrigin(SecurityOrigin*) const override; | 168 bool wouldTaintOrigin(SecurityOrigin*) const override; |
169 FloatSize elementSize(const FloatSize&) const override; | 169 FloatSize elementSize(const FloatSize&) const override; |
170 bool isCanvasElement() const override { return true; } | 170 bool isCanvasElement() const override { return true; } |
171 bool isOpaque() const override; | 171 bool isOpaque() const override; |
172 int sourceWidth() override { return m_size.width(); } | 172 int sourceWidth() override { return m_size.width(); } |
173 int sourceHeight() override { return m_size.height(); } | 173 int sourceHeight() override { return m_size.height(); } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 261 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). |
262 | 262 |
263 // Used for OffscreenCanvas that controls this HTML canvas element | 263 // Used for OffscreenCanvas that controls this HTML canvas element |
264 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; | 264 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; |
265 }; | 265 }; |
266 | 266 |
267 } // namespace blink | 267 } // namespace blink |
268 | 268 |
269 #endif // HTMLCanvasElement_h | 269 #endif // HTMLCanvasElement_h |
OLD | NEW |