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

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

Issue 2802813002: Adds SVGImageElement as a ImageBitmapSource (Closed)
Patch Set: tests Created 3 years, 8 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 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 HTMLAndSVGImageElementSource_h
6 #define CanvasImageElementSource_h 6 #define HTMLAndSVGImageElementSource_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 HTMLAndSVGImageElementSource : public CanvasImageSource,
19 public ImageBitmapSource {
18 public: 20 public:
19 virtual ImageLoader& imageLoader() const = 0; 21 virtual ImageLoader& imageLoader() 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> cropRect,
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* destinationSecurityOrigin) const override; 37 SecurityOrigin* destinationSecurityOrigin) const override;
29 38
30 FloatSize elementSize(const FloatSize& defaultObjectSize) const override; 39 FloatSize elementSize(const FloatSize& defaultObjectSize) const override;
31 FloatSize defaultDestinationSize( 40 FloatSize defaultDestinationSize(
32 const FloatSize& defaultObjectSize) const override; 41 const FloatSize& defaultObjectSize) 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& element() const; 57 const Element& element() const;
48 }; 58 };
49 59
50 } // namespace blink 60 } // namespace blink
51 61
52 #endif // CanvasImageElementSource_h 62 #endif // HTMLAndSVGImageElementSource_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698