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

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

Issue 2723093004: Adds SVGImageElement as a CanvasImageSource (Closed)
Patch Set: Refactored Canvas code out Created 3 years, 9 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/CanvasHTMLSVGImage.h"
25 #include "core/svg/SVGAnimatedLength.h" 26 #include "core/svg/SVGAnimatedLength.h"
26 #include "core/svg/SVGAnimatedPreserveAspectRatio.h" 27 #include "core/svg/SVGAnimatedPreserveAspectRatio.h"
27 #include "core/svg/SVGGraphicsElement.h" 28 #include "core/svg/SVGGraphicsElement.h"
28 #include "core/svg/SVGImageLoader.h" 29 #include "core/svg/SVGImageLoader.h"
29 #include "core/svg/SVGURIReference.h" 30 #include "core/svg/SVGURIReference.h"
30 #include "platform/heap/Handle.h" 31 #include "platform/heap/Handle.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 class SVGImageElement final : public SVGGraphicsElement, 35 class CORE_EXPORT SVGImageElement final : public SVGGraphicsElement,
35 public SVGURIReference { 36 public CanvasHTMLSVGImage,
37 public SVGURIReference {
36 DEFINE_WRAPPERTYPEINFO(); 38 DEFINE_WRAPPERTYPEINFO();
37 USING_GARBAGE_COLLECTED_MIXIN(SVGImageElement); 39 USING_GARBAGE_COLLECTED_MIXIN(SVGImageElement);
38 40
39 public: 41 public:
40 DECLARE_NODE_FACTORY(SVGImageElement); 42 DECLARE_NODE_FACTORY(SVGImageElement);
41 DECLARE_VIRTUAL_TRACE(); 43 DECLARE_VIRTUAL_TRACE();
42 44
43 bool currentFrameHasSingleSecurityOrigin() const; 45 bool currentFrameHasSingleSecurityOrigin() const;
44 46
45 SVGAnimatedLength* x() const { return m_x.get(); } 47 SVGAnimatedLength* x() const { return m_x.get(); }
46 SVGAnimatedLength* y() const { return m_y.get(); } 48 SVGAnimatedLength* y() const { return m_y.get(); }
47 SVGAnimatedLength* width() const { return m_width.get(); } 49 SVGAnimatedLength* width() const { return m_width.get(); }
48 SVGAnimatedLength* height() const { return m_height.get(); } 50 SVGAnimatedLength* height() const { return m_height.get(); }
49 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() { 51 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() {
50 return m_preserveAspectRatio.get(); 52 return m_preserveAspectRatio.get();
51 } 53 }
52 54
53 // Exposed for testing. 55 // Exposed for testing.
54 ImageResourceContent* cachedImage() const { return imageLoader().image(); } 56 ImageResourceContent* cachedImage() const override {
57 return imageLoader().image();
58 }
59
60 // CanvasHTMLSVGImage interface implementation.
61 const Element* element() const override { return this; }
62 bool imageLoaded() const override { return imageLoader().imageComplete(); }
55 63
56 private: 64 private:
57 explicit SVGImageElement(Document&); 65 explicit SVGImageElement(Document&);
58 66
59 bool isStructurallyExternal() const override { 67 bool isStructurallyExternal() const override {
60 return !hrefString().isNull(); 68 return !hrefString().isNull();
61 } 69 }
62 70
63 void collectStyleForPresentationAttribute(const QualifiedName&, 71 void collectStyleForPresentationAttribute(const QualifiedName&,
64 const AtomicString&, 72 const AtomicString&,
(...skipping 20 matching lines...) Expand all
85 Member<SVGAnimatedLength> m_height; 93 Member<SVGAnimatedLength> m_height;
86 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; 94 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio;
87 95
88 Member<SVGImageLoader> m_imageLoader; 96 Member<SVGImageLoader> m_imageLoader;
89 bool m_needsLoaderURIUpdate : 1; 97 bool m_needsLoaderURIUpdate : 1;
90 }; 98 };
91 99
92 } // namespace blink 100 } // namespace blink
93 101
94 #endif // SVGImageElement_h 102 #endif // SVGImageElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698