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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGImageElement.h

Issue 2802813002: Adds SVGImageElement as a ImageBitmapSource (Closed)
Patch Set: test 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 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #ifndef SVGImageElement_h 21 #ifndef SVGImageElement_h
22 #define SVGImageElement_h 22 #define SVGImageElement_h
23 23
24 #include "core/SVGNames.h" 24 #include "core/SVGNames.h"
25 #include "core/html/canvas/CanvasImageElementSource.h" 25 #include "core/html/canvas/CanvasImageElementSource.h"
26 #include "core/imagebitmap/ImageBitmapSource.h"
26 #include "core/svg/SVGAnimatedLength.h" 27 #include "core/svg/SVGAnimatedLength.h"
27 #include "core/svg/SVGAnimatedPreserveAspectRatio.h" 28 #include "core/svg/SVGAnimatedPreserveAspectRatio.h"
28 #include "core/svg/SVGGraphicsElement.h" 29 #include "core/svg/SVGGraphicsElement.h"
29 #include "core/svg/SVGImageLoader.h" 30 #include "core/svg/SVGImageLoader.h"
30 #include "core/svg/SVGURIReference.h" 31 #include "core/svg/SVGURIReference.h"
31 #include "platform/heap/Handle.h" 32 #include "platform/heap/Handle.h"
32 33
33 namespace blink { 34 namespace blink {
34 35
35 class CORE_EXPORT SVGImageElement final : public SVGGraphicsElement, 36 class CORE_EXPORT SVGImageElement final : public SVGGraphicsElement,
37 public ImageBitmapSource,
36 public CanvasImageElementSource, 38 public CanvasImageElementSource,
37 public SVGURIReference { 39 public SVGURIReference {
38 DEFINE_WRAPPERTYPEINFO(); 40 DEFINE_WRAPPERTYPEINFO();
39 USING_GARBAGE_COLLECTED_MIXIN(SVGImageElement); 41 USING_GARBAGE_COLLECTED_MIXIN(SVGImageElement);
40 42
41 public: 43 public:
42 DECLARE_NODE_FACTORY(SVGImageElement); 44 DECLARE_NODE_FACTORY(SVGImageElement);
43 DECLARE_VIRTUAL_TRACE(); 45 DECLARE_VIRTUAL_TRACE();
44 46
45 bool currentFrameHasSingleSecurityOrigin() const; 47 bool currentFrameHasSingleSecurityOrigin() const;
46 48
47 SVGAnimatedLength* x() const { return m_x.get(); } 49 SVGAnimatedLength* x() const { return m_x.get(); }
48 SVGAnimatedLength* y() const { return m_y.get(); } 50 SVGAnimatedLength* y() const { return m_y.get(); }
49 SVGAnimatedLength* width() const { return m_width.get(); } 51 SVGAnimatedLength* width() const { return m_width.get(); }
50 SVGAnimatedLength* height() const { return m_height.get(); } 52 SVGAnimatedLength* height() const { return m_height.get(); }
51 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() { 53 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() {
52 return m_preserveAspectRatio.get(); 54 return m_preserveAspectRatio.get();
53 } 55 }
54 56
55 // Exposed for testing. 57 // Exposed for testing.
56 ImageResourceContent* cachedImage() const { return imageLoader().image(); } 58 ImageResourceContent* cachedImage() const { return imageLoader().image(); }
57 59
60 // ImageBitmapSource implementation
61 IntSize bitmapSourceSize() const override;
62 ScriptPromise createImageBitmap(ScriptState*,
63 EventTarget&,
64 Optional<IntRect> cropRect,
65 const ImageBitmapOptions&,
66 ExceptionState&) override;
67
58 private: 68 private:
59 explicit SVGImageElement(Document&); 69 explicit SVGImageElement(Document&);
60 70
61 bool isStructurallyExternal() const override { 71 bool isStructurallyExternal() const override {
62 return !hrefString().isNull(); 72 return !hrefString().isNull();
63 } 73 }
64 74
65 void collectStyleForPresentationAttribute(const QualifiedName&, 75 void collectStyleForPresentationAttribute(const QualifiedName&,
66 const AtomicString&, 76 const AtomicString&,
67 MutableStylePropertySet*) override; 77 MutableStylePropertySet*) override;
(...skipping 20 matching lines...) Expand all
88 Member<SVGAnimatedLength> m_height; 98 Member<SVGAnimatedLength> m_height;
89 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; 99 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio;
90 100
91 Member<SVGImageLoader> m_imageLoader; 101 Member<SVGImageLoader> m_imageLoader;
92 bool m_needsLoaderURIUpdate : 1; 102 bool m_needsLoaderURIUpdate : 1;
93 }; 103 };
94 104
95 } // namespace blink 105 } // namespace blink
96 106
97 #endif // SVGImageElement_h 107 #endif // SVGImageElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698