2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
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.
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.
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.
21 #ifndef SVGPatternElement_h
22 #define SVGPatternElement_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"
37 struct PatternAttributes;
39 class SVGPatternElement FINAL : public SVGElement,
40 public SVGURIReference,
42 public SVGFitToViewBox {
44 static PassRefPtr<SVGPatternElement> create(Document&);
46 void collectPatternAttributes(PatternAttributes&) const;
48 virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const OVERRIDE;
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(); }
56 explicit SVGPatternElement(Document&);
58 virtual bool isValid() const OVERRIDE { return SVGTests::isValid(); }
59 virtual bool needsPendingResourceHandling() const OVERRIDE { return false; }
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;
66 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
68 virtual bool selfHasRelativeLengths() const OVERRIDE;
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
81 DEFINE_NODE_TYPE_CASTS(SVGPatternElement, hasTagName(SVGNames::patternTag));
83 } // namespace WebCore