Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.h

Issue 1761003003: Use a union typdef for the return type of canvas.getContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final touches Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 class CanvasRenderingContextFactory; 56 class CanvasRenderingContextFactory;
57 class GraphicsContext; 57 class GraphicsContext;
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 CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrI mageBitmapRenderingContext;
67 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO rImageBitmapRenderingContext RenderingContext;
68
66 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 {
67 DEFINE_WRAPPERTYPEINFO(); 70 DEFINE_WRAPPERTYPEINFO();
68 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); 71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement);
69 public: 72 public:
70 DECLARE_NODE_FACTORY(HTMLCanvasElement); 73 DECLARE_NODE_FACTORY(HTMLCanvasElement);
71 ~HTMLCanvasElement() override; 74 ~HTMLCanvasElement() override;
72 75
73 // Attributes and functions exposed to script 76 // Attributes and functions exposed to script
74 int width() const { return size().width(); } 77 int width() const { return size().width(); }
75 int height() const { return size().height(); } 78 int height() const { return size().height(); }
76 79
77 const IntSize& size() const { return m_size; } 80 const IntSize& size() const { return m_size; }
78 81
79 void setWidth(int); 82 void setWidth(int);
80 void setHeight(int); 83 void setHeight(int);
81 84
82 void setSize(const IntSize& newSize) 85 void setSize(const IntSize& newSize)
83 { 86 {
84 if (newSize == size()) 87 if (newSize == size())
85 return; 88 return;
86 m_ignoreReset = true; 89 m_ignoreReset = true;
87 setWidth(newSize.width()); 90 setWidth(newSize.width());
88 setHeight(newSize.height()); 91 setHeight(newSize.height());
89 m_ignoreReset = false; 92 m_ignoreReset = false;
90 reset(); 93 reset();
91 } 94 }
92 95
93 // Called by HTMLCanvasElement's V8 bindings.
94 ScriptValue getContext(ScriptState*, const String&, const CanvasContextCreat ionAttributes&);
95 // Called by Document::getCSSCanvasContext as well as above getContext(). 96 // Called by Document::getCSSCanvasContext as well as above getContext().
96 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva sContextCreationAttributes&); 97 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva sContextCreationAttributes&);
97 98
98 bool isPaintable() const; 99 bool isPaintable() const;
99 100
100 static String toEncodingMimeType(const String& mimeType); 101 static String toEncodingMimeType(const String& mimeType);
101 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const; 102 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const;
102 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); } 103 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); }
103 104
104 void toBlob(BlobCallback*, const String& mimeType, const ScriptValue& qualit yArgument, ExceptionState&); 105 void toBlob(BlobCallback*, const String& mimeType, const ScriptValue& qualit yArgument, ExceptionState&);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 mutable bool m_didFailToCreateImageBuffer; 231 mutable bool m_didFailToCreateImageBuffer;
231 bool m_imageBufferIsClear; 232 bool m_imageBufferIsClear;
232 OwnPtr<ImageBuffer> m_imageBuffer; 233 OwnPtr<ImageBuffer> m_imageBuffer;
233 234
234 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). 235 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue).
235 }; 236 };
236 237
237 } // namespace blink 238 } // namespace blink
238 239
239 #endif // HTMLCanvasElement_h 240 #endif // HTMLCanvasElement_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698