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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 class ImageBuffer; | 66 class ImageBuffer; |
67 class ImageBufferSurface; | 67 class ImageBufferSurface; |
68 class ImageData; | 68 class ImageData; |
69 class IntSize; | 69 class IntSize; |
70 | 70 |
71 class | 71 class |
72 CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrIma
geBitmapRenderingContext; | 72 CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrIma
geBitmapRenderingContext; |
73 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO
rImageBitmapRenderingContext | 73 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO
rImageBitmapRenderingContext |
74 RenderingContext; | 74 RenderingContext; |
75 | 75 |
76 class CORE_EXPORT HTMLCanvasElement final : public HTMLElement, | 76 class CORE_EXPORT HTMLCanvasElement final |
77 public ContextLifecycleObserver, | 77 : public HTMLElement, |
78 public PageVisibilityObserver, | 78 public ContextLifecycleObserver, |
79 public CanvasImageSource, | 79 public PageVisibilityObserver, |
80 public ImageBufferClient, | 80 public CanvasImageSource, |
81 public ImageBitmapSource, | 81 public CanvasSurfaceLayerBridgeObserver, |
82 public OffscreenCanvasPlaceholder { | 82 public ImageBufferClient, |
| 83 public ImageBitmapSource, |
| 84 public OffscreenCanvasPlaceholder { |
83 DEFINE_WRAPPERTYPEINFO(); | 85 DEFINE_WRAPPERTYPEINFO(); |
84 USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); | 86 USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); |
85 USING_PRE_FINALIZER(HTMLCanvasElement, dispose); | 87 USING_PRE_FINALIZER(HTMLCanvasElement, dispose); |
86 | 88 |
87 public: | 89 public: |
88 using Node::getExecutionContext; | 90 using Node::getExecutionContext; |
89 | 91 |
90 DECLARE_NODE_FACTORY(HTMLCanvasElement); | 92 DECLARE_NODE_FACTORY(HTMLCanvasElement); |
91 ~HTMLCanvasElement() override; | 93 ~HTMLCanvasElement() override; |
92 | 94 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 SnapshotReason, | 182 SnapshotReason, |
181 const FloatSize&) const override; | 183 const FloatSize&) const override; |
182 bool wouldTaintOrigin(SecurityOrigin*) const override; | 184 bool wouldTaintOrigin(SecurityOrigin*) const override; |
183 FloatSize elementSize(const FloatSize&) const override; | 185 FloatSize elementSize(const FloatSize&) const override; |
184 bool isCanvasElement() const override { return true; } | 186 bool isCanvasElement() const override { return true; } |
185 bool isOpaque() const override; | 187 bool isOpaque() const override; |
186 bool isAccelerated() const override; | 188 bool isAccelerated() const override; |
187 int sourceWidth() override { return m_size.width(); } | 189 int sourceWidth() override { return m_size.width(); } |
188 int sourceHeight() override { return m_size.height(); } | 190 int sourceHeight() override { return m_size.height(); } |
189 | 191 |
| 192 // CanvasSurfaceLayerBridgeObserver implementation |
| 193 void OnWebLayerReplaced() override; |
| 194 |
190 // ImageBufferClient implementation | 195 // ImageBufferClient implementation |
191 void notifySurfaceInvalid() override; | 196 void notifySurfaceInvalid() override; |
192 bool isDirty() override { return !m_dirtyRect.isEmpty(); } | 197 bool isDirty() override { return !m_dirtyRect.isEmpty(); } |
193 void didDisableAcceleration() override; | 198 void didDisableAcceleration() override; |
194 void didFinalizeFrame() override; | 199 void didFinalizeFrame() override; |
195 void restoreCanvasMatrixClipStack(SkCanvas*) const override; | 200 void restoreCanvasMatrixClipStack(SkCanvas*) const override; |
196 | 201 |
197 void doDeferredPaintInvalidation(); | 202 void doDeferredPaintInvalidation(); |
198 | 203 |
199 // ImageBitmapSource implementation | 204 // ImageBitmapSource implementation |
(...skipping 22 matching lines...) Expand all Loading... |
222 | 227 |
223 // For Canvas HitRegions | 228 // For Canvas HitRegions |
224 bool isSupportedInteractiveCanvasFallback(const Element&); | 229 bool isSupportedInteractiveCanvasFallback(const Element&); |
225 HitTestCanvasResult* getControlAndIdIfHitRegionExists(const LayoutPoint&); | 230 HitTestCanvasResult* getControlAndIdIfHitRegionExists(const LayoutPoint&); |
226 String getIdFromControl(const Element*); | 231 String getIdFromControl(const Element*); |
227 | 232 |
228 // For OffscreenCanvas that controls this html canvas element | 233 // For OffscreenCanvas that controls this html canvas element |
229 CanvasSurfaceLayerBridge* surfaceLayerBridge() const { | 234 CanvasSurfaceLayerBridge* surfaceLayerBridge() const { |
230 return m_surfaceLayerBridge.get(); | 235 return m_surfaceLayerBridge.get(); |
231 } | 236 } |
232 bool createSurfaceLayer(); | 237 void createLayer(); |
233 | 238 |
234 void detachContext() { m_context = nullptr; } | 239 void detachContext() { m_context = nullptr; } |
235 | 240 |
236 protected: | 241 protected: |
237 void didMoveToNewDocument(Document& oldDocument) override; | 242 void didMoveToNewDocument(Document& oldDocument) override; |
238 | 243 |
239 private: | 244 private: |
240 explicit HTMLCanvasElement(Document&); | 245 explicit HTMLCanvasElement(Document&); |
241 void dispose(); | 246 void dispose(); |
242 | 247 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // Used for OffscreenCanvas that controls this HTML canvas element | 311 // Used for OffscreenCanvas that controls this HTML canvas element |
307 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; | 312 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; |
308 | 313 |
309 int m_numFramesSinceLastRenderingModeSwitch; | 314 int m_numFramesSinceLastRenderingModeSwitch; |
310 bool m_pendingRenderingModeSwitch; | 315 bool m_pendingRenderingModeSwitch; |
311 }; | 316 }; |
312 | 317 |
313 } // namespace blink | 318 } // namespace blink |
314 | 319 |
315 #endif // HTMLCanvasElement_h | 320 #endif // HTMLCanvasElement_h |
OLD | NEW |