OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CanvasImageElementSource_h | 5 #ifndef ImageElementBase_h |
6 #define CanvasImageElementSource_h | 6 #define ImageElementBase_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/html/canvas/CanvasImageSource.h" | 9 #include "core/html/canvas/CanvasImageSource.h" |
| 10 #include "core/imagebitmap/ImageBitmapSource.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 class Element; | 14 class Element; |
14 class ImageLoader; | 15 class ImageLoader; |
15 class ImageResourceContent; | 16 class ImageResourceContent; |
16 | 17 |
17 class CORE_EXPORT CanvasImageElementSource : public CanvasImageSource { | 18 class CORE_EXPORT ImageElementBase : public CanvasImageSource, |
| 19 public ImageBitmapSource { |
18 public: | 20 public: |
19 virtual ImageLoader& GetImageLoader() const = 0; | 21 virtual ImageLoader& GetImageLoader() const = 0; |
20 virtual FloatSize SourceDefaultObjectSize() = 0; | 22 virtual FloatSize SourceDefaultObjectSize() = 0; |
21 | 23 |
| 24 IntSize BitmapSourceSize() const override; |
| 25 ScriptPromise CreateImageBitmap(ScriptState*, |
| 26 EventTarget&, |
| 27 Optional<IntRect>, |
| 28 const ImageBitmapOptions&, |
| 29 ExceptionState&) override; |
| 30 |
22 PassRefPtr<Image> GetSourceImageForCanvas(SourceImageStatus*, | 31 PassRefPtr<Image> GetSourceImageForCanvas(SourceImageStatus*, |
23 AccelerationHint, | 32 AccelerationHint, |
24 SnapshotReason, | 33 SnapshotReason, |
25 const FloatSize&) const override; | 34 const FloatSize&) const override; |
26 | 35 |
27 bool WouldTaintOrigin( | 36 bool WouldTaintOrigin( |
28 SecurityOrigin* destination_security_origin) const override; | 37 SecurityOrigin* destination_security_origin) const override; |
29 | 38 |
30 FloatSize ElementSize(const FloatSize& default_object_size) const override; | 39 FloatSize ElementSize(const FloatSize& default_object_size) const override; |
31 FloatSize DefaultDestinationSize( | 40 FloatSize DefaultDestinationSize( |
32 const FloatSize& default_object_size) const override; | 41 const FloatSize& default_object_size) const override; |
33 | 42 |
34 bool IsAccelerated() const override; | 43 bool IsAccelerated() const override; |
35 | 44 |
36 int SourceWidth() override; | 45 int SourceWidth() override; |
37 int SourceHeight() override; | 46 int SourceHeight() override; |
38 | 47 |
39 bool IsSVGSource() const override; | 48 bool IsSVGSource() const override; |
40 | 49 |
41 bool IsOpaque() const override; | 50 bool IsOpaque() const override; |
42 | 51 |
43 const KURL& SourceURL() const override; | 52 const KURL& SourceURL() const override; |
44 | 53 |
| 54 ImageResourceContent* CachedImage() const; |
| 55 |
45 private: | 56 private: |
46 ImageResourceContent* CachedImage() const; | |
47 const Element& GetElement() const; | 57 const Element& GetElement() const; |
48 }; | 58 }; |
49 | 59 |
50 } // namespace blink | 60 } // namespace blink |
51 | 61 |
52 #endif // CanvasImageElementSource_h | 62 #endif // ImageElementBase_h |
OLD | NEW |