Upstream version 9.38.198.0
[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 "core/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 blink {
36
37 struct PatternAttributes;
38
39 class SVGPatternElement FINAL : public SVGElement,
40                                 public SVGURIReference,
41                                 public SVGTests,
42                                 public SVGFitToViewBox {
43 public:
44     DECLARE_NODE_FACTORY(SVGPatternElement);
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     SVGAnimatedTransformList* patternTransform() { return m_patternTransform.get(); }
55     const SVGAnimatedTransformList* patternTransform() const { return m_patternTransform.get(); }
56     SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>* patternUnits() { return m_patternUnits.get(); }
57     SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>* patternContentUnits() { return m_patternContentUnits.get(); }
58     const SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>* patternUnits() const { return m_patternUnits.get(); }
59     const SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>* patternContentUnits() const { return m_patternContentUnits.get(); }
60
61 private:
62     explicit SVGPatternElement(Document&);
63
64     virtual bool isValid() const OVERRIDE { return SVGTests::isValid(); }
65     virtual bool needsPendingResourceHandling() const OVERRIDE { return false; }
66
67     bool isSupportedAttribute(const QualifiedName&);
68     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
69     virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
70     virtual void childrenChanged(const ChildrenChange&) OVERRIDE;
71
72     virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
73
74     virtual bool selfHasRelativeLengths() const OVERRIDE;
75
76     RefPtr<SVGAnimatedLength> m_x;
77     RefPtr<SVGAnimatedLength> m_y;
78     RefPtr<SVGAnimatedLength> m_width;
79     RefPtr<SVGAnimatedLength> m_height;
80     RefPtr<SVGAnimatedTransformList> m_patternTransform;
81     RefPtr<SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType> > m_patternUnits;
82     RefPtr<SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType> > m_patternContentUnits;
83 };
84
85 } // namespace blink
86
87 #endif