OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef OffscreenCanvas_h | 5 #ifndef OffscreenCanvas_h |
6 #define OffscreenCanvas_h | 6 #define OffscreenCanvas_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // IDL attributes | 25 // IDL attributes |
26 unsigned width() const { return m_size.width(); } | 26 unsigned width() const { return m_size.width(); } |
27 unsigned height() const { return m_size.height(); } | 27 unsigned height() const { return m_size.height(); } |
28 void setWidth(unsigned); | 28 void setWidth(unsigned); |
29 void setHeight(unsigned); | 29 void setHeight(unsigned); |
30 | 30 |
31 // API Methods | 31 // API Methods |
32 ImageBitmap* transferToImageBitmap(ExceptionState&); | 32 ImageBitmap* transferToImageBitmap(ExceptionState&); |
33 | 33 |
34 IntSize size() const { return m_size; } | 34 IntSize size() const { return m_size; } |
35 void setAssociatedCanvas(HTMLCanvasElement* canvas) { m_canvas = canvas; } | 35 void setAssociatedCanvasId(int canvasId) { m_canvasId = canvasId; } |
36 HTMLCanvasElement* getAssociatedCanvas() const { return m_canvas; } | 36 int getAssociatedCanvasId() const { return m_canvasId; } |
| 37 bool isNeutered() const { return m_isNeutered; } |
| 38 void setNeutered(); |
37 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva
sContextCreationAttributes&); | 39 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva
sContextCreationAttributes&); |
| 40 CanvasRenderingContext* renderingContext() { return m_context; } |
38 | 41 |
39 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex
tFactory>); | 42 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex
tFactory>); |
40 | 43 |
41 DECLARE_VIRTUAL_TRACE(); | 44 DECLARE_VIRTUAL_TRACE(); |
42 | 45 |
43 private: | 46 private: |
44 explicit OffscreenCanvas(const IntSize&); | 47 explicit OffscreenCanvas(const IntSize&); |
45 | 48 |
46 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; | 49 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; |
47 static ContextFactoryVector& renderingContextFactories(); | 50 static ContextFactoryVector& renderingContextFactories(); |
48 static CanvasRenderingContextFactory* getRenderingContextFactory(int); | 51 static CanvasRenderingContextFactory* getRenderingContextFactory(int); |
49 | 52 |
50 Member<CanvasRenderingContext> m_context; | 53 Member<CanvasRenderingContext> m_context; |
51 WeakMember<HTMLCanvasElement> m_canvas; | 54 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as
sociated canvas element. |
52 IntSize m_size; | 55 IntSize m_size; |
| 56 bool m_isNeutered = false; |
53 }; | 57 }; |
54 | 58 |
55 } // namespace blink | 59 } // namespace blink |
56 | 60 |
57 #endif // OffscreenCanvas_h | 61 #endif // OffscreenCanvas_h |
OLD | NEW |