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

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

Issue 2344563002: Remove the lifetime hack in ImageLoader where it keeps its assoc element alive
Patch Set: fix 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 /* 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 "bindings/core/v8/ActiveScriptWrappable.h"
24 #include "core/SVGNames.h" 25 #include "core/SVGNames.h"
25 #include "core/svg/SVGAnimatedBoolean.h" 26 #include "core/svg/SVGAnimatedBoolean.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 SVGImageElement final : public SVGGraphicsElement, 36 class SVGImageElement final : public SVGGraphicsElement, public SVGURIReference, public ActiveScriptWrappable {
36 public SVGURIReference {
37 DEFINE_WRAPPERTYPEINFO(); 37 DEFINE_WRAPPERTYPEINFO();
38 USING_GARBAGE_COLLECTED_MIXIN(SVGImageElement); 38 USING_GARBAGE_COLLECTED_MIXIN(SVGImageElement);
39 public: 39 public:
40 DECLARE_NODE_FACTORY(SVGImageElement); 40 DECLARE_NODE_FACTORY(SVGImageElement);
41 DECLARE_VIRTUAL_TRACE(); 41 DECLARE_VIRTUAL_TRACE();
42 42
43 bool currentFrameHasSingleSecurityOrigin() const; 43 bool currentFrameHasSingleSecurityOrigin() const;
44 44
45 SVGAnimatedLength* x() const { return m_x.get(); } 45 SVGAnimatedLength* x() const { return m_x.get(); }
46 SVGAnimatedLength* y() const { return m_y.get(); } 46 SVGAnimatedLength* y() const { return m_y.get(); }
47 SVGAnimatedLength* width() const { return m_width.get(); } 47 SVGAnimatedLength* width() const { return m_width.get(); }
48 SVGAnimatedLength* height() const { return m_height.get(); } 48 SVGAnimatedLength* height() const { return m_height.get(); }
49 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() { return m_preserveAsp ectRatio.get(); } 49 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() { return m_preserveAsp ectRatio.get(); }
50 50
51 bool hasPendingActivity() const final { return imageLoader().hasPendingActiv ity(); }
52
51 // Exposed for testing. 53 // Exposed for testing.
52 ImageResource* cachedImage() const { return imageLoader().image(); } 54 ImageResource* cachedImage() const { return imageLoader().image(); }
53 55
54 private: 56 private:
55 explicit SVGImageElement(Document&); 57 explicit SVGImageElement(Document&);
56 58
57 bool isStructurallyExternal() const override { return !hrefString().isNull() ; } 59 bool isStructurallyExternal() const override { return !hrefString().isNull() ; }
58 60
59 bool isPresentationAttribute(const QualifiedName&) const override; 61 bool isPresentationAttribute(const QualifiedName&) const override;
60 bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const override; 62 bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const override;
(...skipping 20 matching lines...) Expand all
81 Member<SVGAnimatedLength> m_height; 83 Member<SVGAnimatedLength> m_height;
82 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; 84 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio;
83 85
84 Member<SVGImageLoader> m_imageLoader; 86 Member<SVGImageLoader> m_imageLoader;
85 bool m_needsLoaderURIUpdate : 1; 87 bool m_needsLoaderURIUpdate : 1;
86 }; 88 };
87 89
88 } // namespace blink 90 } // namespace blink
89 91
90 #endif // SVGImageElement_h 92 #endif // SVGImageElement_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/ImageLoader.cpp ('k') | third_party/WebKit/Source/core/svg/SVGImageElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698