Upstream version 8.37.180.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / SVGImageElement.h
1 /*
2  * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3  * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
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
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef SVGImageElement_h
22 #define SVGImageElement_h
23
24 #include "core/SVGNames.h"
25 #include "core/svg/SVGAnimatedBoolean.h"
26 #include "core/svg/SVGAnimatedLength.h"
27 #include "core/svg/SVGAnimatedPreserveAspectRatio.h"
28 #include "core/svg/SVGGraphicsElement.h"
29 #include "core/svg/SVGImageLoader.h"
30 #include "core/svg/SVGURIReference.h"
31
32 namespace WebCore {
33
34 class SVGImageElement FINAL : public SVGGraphicsElement,
35                               public SVGURIReference {
36 public:
37     DECLARE_NODE_FACTORY(SVGImageElement);
38     virtual void trace(Visitor*) OVERRIDE;
39
40     bool currentFrameHasSingleSecurityOrigin() const;
41
42     SVGAnimatedLength* x() const { return m_x.get(); }
43     SVGAnimatedLength* y() const { return m_y.get(); }
44     SVGAnimatedLength* width() const { return m_width.get(); }
45     SVGAnimatedLength* height() const { return m_height.get(); }
46     SVGAnimatedPreserveAspectRatio* preserveAspectRatio() { return m_preserveAspectRatio.get(); }
47
48 private:
49     explicit SVGImageElement(Document&);
50
51     virtual bool isStructurallyExternal() const OVERRIDE { return !hrefString().isNull(); }
52
53     bool isSupportedAttribute(const QualifiedName&);
54     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
55     virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
56     virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
57     virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
58
59     virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
60     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
61
62     virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
63
64     virtual const AtomicString imageSourceURL() const OVERRIDE;
65
66     virtual bool haveLoadedRequiredResources() OVERRIDE;
67
68     virtual bool selfHasRelativeLengths() const OVERRIDE;
69     virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
70     SVGImageLoader& imageLoader() { return *m_imageLoader; }
71
72     RefPtr<SVGAnimatedLength> m_x;
73     RefPtr<SVGAnimatedLength> m_y;
74     RefPtr<SVGAnimatedLength> m_width;
75     RefPtr<SVGAnimatedLength> m_height;
76     RefPtr<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio;
77
78     OwnPtrWillBeMember<SVGImageLoader> m_imageLoader;
79     bool m_needsLoaderURIUpdate : 1;
80 };
81
82 } // namespace WebCore
83
84 #endif