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

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

Issue 1455763002: Use union type in ImageBitmapFactories.idl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better argument passing Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 14 matching lines...) Expand all
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef ImageData_h 29 #ifndef ImageData_h
30 #define ImageData_h 30 #define ImageData_h
31 31
32 #include "bindings/core/v8/ScriptWrappable.h" 32 #include "bindings/core/v8/ScriptWrappable.h"
33 #include "core/CoreExport.h" 33 #include "core/CoreExport.h"
34 #include "core/dom/DOMTypedArray.h" 34 #include "core/dom/DOMTypedArray.h"
35 #include "core/imagebitmap/ImageBitmapSource.h"
36 #include "platform/geometry/IntRect.h"
35 #include "platform/geometry/IntSize.h" 37 #include "platform/geometry/IntSize.h"
36 #include "platform/heap/Handle.h" 38 #include "platform/heap/Handle.h"
37 #include "wtf/RefPtr.h" 39 #include "wtf/RefPtr.h"
38 40
39 namespace blink { 41 namespace blink {
40 42
41 class ExceptionState; 43 class ExceptionState;
42 44
43 class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>, public ScriptWrappable { 45 class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>, public ScriptWrappable, public ImageBitmapSource {
44 DEFINE_WRAPPERTYPEINFO(); 46 DEFINE_WRAPPERTYPEINFO();
45 public: 47 public:
46 static ImageData* create(const IntSize&); 48 static ImageData* create(const IntSize&);
47 static ImageData* create(const IntSize&, PassRefPtr<DOMUint8ClampedArray>); 49 static ImageData* create(const IntSize&, PassRefPtr<DOMUint8ClampedArray>);
48 static ImageData* create(unsigned width, unsigned height, ExceptionState&); 50 static ImageData* create(unsigned width, unsigned height, ExceptionState&);
49 static ImageData* create(DOMUint8ClampedArray*, unsigned width, ExceptionSta te&); 51 static ImageData* create(DOMUint8ClampedArray*, unsigned width, ExceptionSta te&);
50 static ImageData* create(DOMUint8ClampedArray*, unsigned width, unsigned hei ght, ExceptionState&); 52 static ImageData* create(DOMUint8ClampedArray*, unsigned width, unsigned hei ght, ExceptionState&);
51 53
52 IntSize size() const { return m_size; } 54 IntSize size() const { return m_size; }
53 int width() const { return m_size.width(); } 55 int width() const { return m_size.width(); }
54 int height() const { return m_size.height(); } 56 int height() const { return m_size.height(); }
55 const DOMUint8ClampedArray* data() const { return m_data.get(); } 57 const DOMUint8ClampedArray* data() const { return m_data.get(); }
56 DOMUint8ClampedArray* data() { return m_data.get(); } 58 DOMUint8ClampedArray* data() { return m_data.get(); }
57 59
60 // ImageBitmapSource implementation
61 IntSize bitmapSourceSize() const override { return m_size; }
62 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, ExceptionState&) override;
63
58 DEFINE_INLINE_TRACE() { } 64 DEFINE_INLINE_TRACE() { }
59 65
60 void dispose(); 66 void dispose();
61 67
62 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; 68 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN;
63 69
64 private: 70 private:
65 ImageData(const IntSize&, PassRefPtr<DOMUint8ClampedArray>); 71 ImageData(const IntSize&, PassRefPtr<DOMUint8ClampedArray>);
66 72
67 static bool validateConstructorArguments(DOMUint8ClampedArray*, unsigned wid th, unsigned&, ExceptionState&); 73 static bool validateConstructorArguments(DOMUint8ClampedArray*, unsigned wid th, unsigned&, ExceptionState&);
68 74
69 IntSize m_size; 75 IntSize m_size;
70 RefPtr<DOMUint8ClampedArray> m_data; 76 RefPtr<DOMUint8ClampedArray> m_data;
71 }; 77 };
72 78
73 } // namespace blink 79 } // namespace blink
74 80
75 #endif // ImageData_h 81 #endif // ImageData_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLVideoElement.cpp ('k') | third_party/WebKit/Source/core/html/ImageData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698