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

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmap.h

Issue 2249853008: Reject createImageBitmap promise when the cropRect or resize is too big (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update tests Created 4 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ImageBitmap_h 5 #ifndef ImageBitmap_h
6 #define ImageBitmap_h 6 #define ImageBitmap_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/CoreExport.h" 9 #include "core/CoreExport.h"
10 #include "core/html/HTMLImageElement.h" 10 #include "core/html/HTMLImageElement.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 static ImageBitmap* create(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32_t height, bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean) ; 50 static ImageBitmap* create(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32_t height, bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean) ;
51 static PassRefPtr<SkImage> getSkImageFromDecoder(std::unique_ptr<ImageDecode r>); 51 static PassRefPtr<SkImage> getSkImageFromDecoder(std::unique_ptr<ImageDecode r>);
52 static bool isResizeOptionValid(const ImageBitmapOptions&, ExceptionState&); 52 static bool isResizeOptionValid(const ImageBitmapOptions&, ExceptionState&);
53 static bool isSourceSizeValid(int sourceWidth, int sourceHeight, ExceptionSt ate&); 53 static bool isSourceSizeValid(int sourceWidth, int sourceHeight, ExceptionSt ate&);
54 54
55 // Type and helper function required by CallbackPromiseAdapter: 55 // Type and helper function required by CallbackPromiseAdapter:
56 using WebType = sk_sp<SkImage>; 56 using WebType = sk_sp<SkImage>;
57 static ImageBitmap* take(ScriptPromiseResolver*, sk_sp<SkImage>); 57 static ImageBitmap* take(ScriptPromiseResolver*, sk_sp<SkImage>);
58 58
59 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; } 59 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; }
60 std::unique_ptr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPre multiplyAlpha, DataColorFormat format = RGBAColorType); 60 PassRefPtr<Uint8Array> copyBitmapData(AlphaDisposition = DontPremultiplyAlph a, DataColorFormat = RGBAColorType);
61 unsigned long width() const; 61 unsigned long width() const;
62 unsigned long height() const; 62 unsigned long height() const;
63 IntSize size() const; 63 IntSize size() const;
64 64
65 bool isNeutered() const { return m_isNeutered; } 65 bool isNeutered() const { return m_isNeutered; }
66 bool originClean() const { return m_image->originClean(); } 66 bool originClean() const { return m_image->originClean(); }
67 bool isPremultiplied() const { return m_image->isPremultiplied(); } 67 bool isPremultiplied() const { return m_image->isPremultiplied(); }
68 PassRefPtr<StaticBitmapImage> transfer(); 68 PassRefPtr<StaticBitmapImage> transfer();
69 void close(); 69 void close();
70 bool isTextureBacked() const; 70 bool isTextureBacked() const;
(...skipping 25 matching lines...) Expand all
96 ImageBitmap(PassRefPtr<StaticBitmapImage>, Optional<IntRect>, const ImageBit mapOptions&); 96 ImageBitmap(PassRefPtr<StaticBitmapImage>, Optional<IntRect>, const ImageBit mapOptions&);
97 ImageBitmap(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32_t height , bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean); 97 ImageBitmap(std::unique_ptr<uint8_t[]> data, uint32_t width, uint32_t height , bool isImageBitmapPremultiplied, bool isImageBitmapOriginClean);
98 98
99 RefPtr<StaticBitmapImage> m_image; 99 RefPtr<StaticBitmapImage> m_image;
100 bool m_isNeutered = false; 100 bool m_isNeutered = false;
101 }; 101 };
102 102
103 } // namespace blink 103 } // namespace blink
104 104
105 #endif // ImageBitmap_h 105 #endif // ImageBitmap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698