44cf6f9674141bfbe9b7b5ae390a58304fa9ac2d
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / SVGPatternElement.h
1 /*
2  * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3  * Copyright (C) 2004, 2005, 2006, 2007 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 SVGPatternElement_h
22 #define SVGPatternElement_h
23
24 #include "SVGNames.h"
25 #include "core/svg/SVGAnimatedBoolean.h"
26 #include "core/svg/SVGAnimatedEnumeration.h"
27 #include "core/svg/SVGAnimatedLength.h"
28 #include "core/svg/SVGAnimatedTransformList.h"
29 #include "core/svg/SVGElement.h"
30 #include "core/svg/SVGFitToViewBox.h"
31 #include "core/svg/SVGTests.h"
32 #include "core/svg/SVGURIReference.h"
33 #include "core/svg/SVGUnitTypes.h"
34
35 namespace WebCore {
36
37 struct PatternAttributes;
38
39 class SVGPatternElement FINAL : public SVGElement,
40                                 public SVGURIReference,
41                                 public SVGTests,
42                                 public SVGFitToViewBox {
43 public:
44     static PassRefPtr<SVGPatternElement> create(Document&);
45
46     void collectPatternAttributes(PatternAttributes&) const;
47
48     virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const OVERRIDE;
49
50     SVGAnimatedLength* x() const { return m_x.get(); }
51     SVGAnimatedLength* y() const { return m_y.get(); }
52     SVGAnimatedLength* width() const { return m_width.get(); }
53     SVGAnimatedLength* height() const { return m_height.get(); }
54
55 private:
56     explicit SVGPatternElement(Document&);
57
58     virtual bool isValid() const OVERRIDE { return SVGTests::isValid(); }
59     virtual bool needsPendingResourceHandling() const OVERRIDE { return false; }
60
61     bool isSupportedAttribute(const QualifiedName&);
62     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
63     virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
64     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE;
65
66     virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
67
68     virtual bool selfHasRelativeLengths() const OVERRIDE;
69
70     RefPtr<SVGAnimatedLength> m_x;
71     RefPtr<SVGAnimatedLength> m_y;
72     RefPtr<SVGAnimatedLength> m_width;
73     RefPtr<SVGAnimatedLength> m_height;
74     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPatternElement)
75         DECLARE_ANIMATED_ENUMERATION(PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType)
76         DECLARE_ANIMATED_ENUMERATION(PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType)
77         DECLARE_ANIMATED_TRANSFORM_LIST(PatternTransform, patternTransform)
78     END_DECLARE_ANIMATED_PROPERTIES
79 };
80
81 DEFINE_NODE_TYPE_CASTS(SVGPatternElement, hasTagName(SVGNames::patternTag));
82
83 } // namespace WebCore
84
85 #endif