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