| 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 class ImageBuffer; | 61 class ImageBuffer; |
| 62 class ImageBufferSurface; | 62 class ImageBufferSurface; |
| 63 class ImageData; | 63 class ImageData; |
| 64 class IntSize; | 64 class IntSize; |
| 65 | 65 |
| 66 class CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrI
mageBitmapRenderingContext; | 66 class CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrI
mageBitmapRenderingContext; |
| 67 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO
rImageBitmapRenderingContext RenderingContext; | 67 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO
rImageBitmapRenderingContext RenderingContext; |
| 68 | 68 |
| 69 class CORE_EXPORT HTMLCanvasElement final : public HTMLElement, public DocumentV
isibilityObserver, public CanvasImageSource, public ImageBufferClient, public Im
ageBitmapSource { | 69 class CORE_EXPORT HTMLCanvasElement final : public HTMLElement, public DocumentV
isibilityObserver, public CanvasImageSource, public ImageBufferClient, public Im
ageBitmapSource { |
| 70 DEFINE_WRAPPERTYPEINFO(); | 70 DEFINE_WRAPPERTYPEINFO(); |
| 71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); | 71 USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); |
| 72 public: | 72 public: |
| 73 DECLARE_NODE_FACTORY(HTMLCanvasElement); | 73 DECLARE_NODE_FACTORY(HTMLCanvasElement); |
| 74 ~HTMLCanvasElement() override; | 74 ~HTMLCanvasElement() override; |
| 75 | 75 |
| 76 // Attributes and functions exposed to script | 76 // Attributes and functions exposed to script |
| 77 int width() const { return size().width(); } | 77 int width() const { return size().width(); } |
| 78 int height() const { return size().height(); } | 78 int height() const { return size().height(); } |
| 79 | 79 |
| 80 const IntSize& size() const { return m_size; } | 80 const IntSize& size() const { return m_size; } |
| 81 | 81 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 // Used for rendering | 117 // Used for rendering |
| 118 void didDraw(const FloatRect&); | 118 void didDraw(const FloatRect&); |
| 119 | 119 |
| 120 void paint(GraphicsContext&, const LayoutRect&); | 120 void paint(GraphicsContext&, const LayoutRect&); |
| 121 | 121 |
| 122 SkCanvas* drawingCanvas() const; | 122 SkCanvas* drawingCanvas() const; |
| 123 void disableDeferral(DisableDeferralReason) const; | 123 void disableDeferral(DisableDeferralReason) const; |
| 124 SkCanvas* existingDrawingCanvas() const; | 124 SkCanvas* existingDrawingCanvas() const; |
| 125 | 125 |
| 126 void setRenderingContext(PassOwnPtrWillBeRawPtr<CanvasRenderingContext>); | 126 void setRenderingContext(RawPtr<CanvasRenderingContext>); |
| 127 CanvasRenderingContext* renderingContext() const { return m_context.get(); } | 127 CanvasRenderingContext* renderingContext() const { return m_context.get(); } |
| 128 | 128 |
| 129 void ensureUnacceleratedImageBuffer(); | 129 void ensureUnacceleratedImageBuffer(); |
| 130 ImageBuffer* buffer() const; | 130 ImageBuffer* buffer() const; |
| 131 PassRefPtr<Image> copiedImage(SourceDrawingBuffer, AccelerationHint) const; | 131 PassRefPtr<Image> copiedImage(SourceDrawingBuffer, AccelerationHint) const; |
| 132 void clearCopiedImage(); | 132 void clearCopiedImage(); |
| 133 | 133 |
| 134 SecurityOrigin* getSecurityOrigin() const; | 134 SecurityOrigin* getSecurityOrigin() const; |
| 135 bool originClean() const; | 135 bool originClean() const; |
| 136 void setOriginTainted() { m_originClean = false; } | 136 void setOriginTainted() { m_originClean = false; } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 bool shouldUseDisplayList(const IntSize& deviceSize); | 212 bool shouldUseDisplayList(const IntSize& deviceSize); |
| 213 | 213 |
| 214 void setSurfaceSize(const IntSize&); | 214 void setSurfaceSize(const IntSize&); |
| 215 | 215 |
| 216 bool paintsIntoCanvasBuffer() const; | 216 bool paintsIntoCanvasBuffer() const; |
| 217 | 217 |
| 218 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const; | 218 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const; |
| 219 | 219 |
| 220 String toDataURLInternal(const String& mimeType, const double& quality, Sour
ceDrawingBuffer) const; | 220 String toDataURLInternal(const String& mimeType, const double& quality, Sour
ceDrawingBuffer) const; |
| 221 | 221 |
| 222 PersistentHeapHashSetWillBeHeapHashSet<WeakMember<CanvasDrawListener>> m_lis
teners; | 222 HeapHashSet<WeakMember<CanvasDrawListener>> m_listeners; |
| 223 | 223 |
| 224 IntSize m_size; | 224 IntSize m_size; |
| 225 | 225 |
| 226 OwnPtrWillBeMember<CanvasRenderingContext> m_context; | 226 Member<CanvasRenderingContext> m_context; |
| 227 | 227 |
| 228 bool m_ignoreReset; | 228 bool m_ignoreReset; |
| 229 FloatRect m_dirtyRect; | 229 FloatRect m_dirtyRect; |
| 230 | 230 |
| 231 mutable intptr_t m_externallyAllocatedMemory; | 231 mutable intptr_t m_externallyAllocatedMemory; |
| 232 | 232 |
| 233 bool m_originClean; | 233 bool m_originClean; |
| 234 | 234 |
| 235 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer | 235 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer |
| 236 // after the first attempt failed. | 236 // after the first attempt failed. |
| 237 mutable bool m_didFailToCreateImageBuffer; | 237 mutable bool m_didFailToCreateImageBuffer; |
| 238 bool m_imageBufferIsClear; | 238 bool m_imageBufferIsClear; |
| 239 OwnPtr<ImageBuffer> m_imageBuffer; | 239 OwnPtr<ImageBuffer> m_imageBuffer; |
| 240 | 240 |
| 241 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 241 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 } // namespace blink | 244 } // namespace blink |
| 245 | 245 |
| 246 #endif // HTMLCanvasElement_h | 246 #endif // HTMLCanvasElement_h |
| OLD | NEW |