| 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 23 matching lines...) Expand all Loading... |
| 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/PageLifecycleObserver.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/GraphicsTypes.h" | 45 #include "platform/graphics/GraphicsTypes.h" |
| 45 #include "platform/graphics/GraphicsTypes3D.h" | 46 #include "platform/graphics/GraphicsTypes3D.h" |
| 46 #include "platform/graphics/ImageBufferClient.h" | 47 #include "platform/graphics/ImageBufferClient.h" |
| 47 #include "platform/heap/Handle.h" | 48 #include "platform/heap/Handle.h" |
| 48 | 49 |
| 49 #define CanvasDefaultInterpolationQuality InterpolationLow | 50 #define CanvasDefaultInterpolationQuality InterpolationLow |
| 50 | 51 |
| 51 namespace blink { | 52 namespace blink { |
| 52 | 53 |
| 53 class AffineTransform; | 54 class AffineTransform; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 191 |
| 191 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS
tyle); | 192 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS
tyle); |
| 192 | 193 |
| 193 void notifyListenersCanvasChanged(); | 194 void notifyListenersCanvasChanged(); |
| 194 | 195 |
| 195 // For Canvas HitRegions | 196 // For Canvas HitRegions |
| 196 bool isSupportedInteractiveCanvasFallback(const Element&); | 197 bool isSupportedInteractiveCanvasFallback(const Element&); |
| 197 std::pair<Element*, String> getControlAndIdIfHitRegionExists(const LayoutPoi
nt&); | 198 std::pair<Element*, String> getControlAndIdIfHitRegionExists(const LayoutPoi
nt&); |
| 198 String getIdFromControl(const Element*); | 199 String getIdFromControl(const Element*); |
| 199 | 200 |
| 201 // For OffscreenCanvas that controls this html canvas element |
| 202 CanvasSurfaceLayerBridge* surfaceLayerBridge() const { return m_surfaceLayer
Bridge.get(); } |
| 203 void createSurfaceLayerBridge(); |
| 204 |
| 200 protected: | 205 protected: |
| 201 void didMoveToNewDocument(Document& oldDocument) override; | 206 void didMoveToNewDocument(Document& oldDocument) override; |
| 202 | 207 |
| 203 private: | 208 private: |
| 204 explicit HTMLCanvasElement(Document&); | 209 explicit HTMLCanvasElement(Document&); |
| 205 | 210 |
| 206 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; | 211 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; |
| 207 static ContextFactoryVector& renderingContextFactories(); | 212 static ContextFactoryVector& renderingContextFactories(); |
| 208 static CanvasRenderingContextFactory* getRenderingContextFactory(int); | 213 static CanvasRenderingContextFactory* getRenderingContextFactory(int); |
| 209 | 214 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 239 | 244 |
| 240 bool m_originClean; | 245 bool m_originClean; |
| 241 | 246 |
| 242 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer | 247 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t
o allocate an imageBuffer |
| 243 // after the first attempt failed. | 248 // after the first attempt failed. |
| 244 mutable bool m_didFailToCreateImageBuffer; | 249 mutable bool m_didFailToCreateImageBuffer; |
| 245 bool m_imageBufferIsClear; | 250 bool m_imageBufferIsClear; |
| 246 OwnPtr<ImageBuffer> m_imageBuffer; | 251 OwnPtr<ImageBuffer> m_imageBuffer; |
| 247 | 252 |
| 248 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 253 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). |
| 254 |
| 255 // Used for OffscreenCanvas that controls this HTML canvas element |
| 256 OwnPtr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; |
| 249 }; | 257 }; |
| 250 | 258 |
| 251 } // namespace blink | 259 } // namespace blink |
| 252 | 260 |
| 253 #endif // HTMLCanvasElement_h | 261 #endif // HTMLCanvasElement_h |
| OLD | NEW |