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#if ENABLE(SVG)
25#include "SVGAnimatedBoolean.h"
26#include "SVGAnimatedEnumeration.h"
27#include "SVGAnimatedLength.h"
28#include "SVGAnimatedPreserveAspectRatio.h"
29#include "SVGAnimatedRect.h"
30#include "SVGAnimatedTransformList.h"
31#include "SVGExternalResourcesRequired.h"
32#include "SVGFitToViewBox.h"
33#include "SVGLangSpace.h"
34#include "SVGStyledElement.h"
35#include "SVGTests.h"
36#include "SVGURIReference.h"
37#include "SVGUnitTypes.h"
38
39namespace WebCore {
40
41struct PatternAttributes;
42
43class SVGPatternElement FINAL : public SVGStyledElement,
44                                public SVGURIReference,
45                                public SVGTests,
46                                public SVGLangSpace,
47                                public SVGExternalResourcesRequired,
48                                public SVGFitToViewBox {
49public:
50    static PassRefPtr<SVGPatternElement> create(const QualifiedName&, Document*);
51
52    void collectPatternAttributes(PatternAttributes&) const;
53
54    virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
55
56private:
57    SVGPatternElement(const QualifiedName&, Document*);
58
59    virtual bool isValid() const { return SVGTests::isValid(); }
60    virtual bool needsPendingResourceHandling() const { return false; }
61
62    bool isSupportedAttribute(const QualifiedName&);
63    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
64    virtual void svgAttributeChanged(const QualifiedName&);
65    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
66
67    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
68
69    virtual bool selfHasRelativeLengths() const;
70
71    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPatternElement)
72        DECLARE_ANIMATED_LENGTH(X, x)
73        DECLARE_ANIMATED_LENGTH(Y, y)
74        DECLARE_ANIMATED_LENGTH(Width, width)
75        DECLARE_ANIMATED_LENGTH(Height, height)
76        DECLARE_ANIMATED_ENUMERATION(PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType)
77        DECLARE_ANIMATED_ENUMERATION(PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType)
78        DECLARE_ANIMATED_TRANSFORM_LIST(PatternTransform, patternTransform)
79        DECLARE_ANIMATED_STRING(Href, href)
80        DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
81        DECLARE_ANIMATED_RECT(ViewBox, viewBox)
82        DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
83    END_DECLARE_ANIMATED_PROPERTIES
84
85    // SVGTests
86    virtual void synchronizeRequiredFeatures() { SVGTests::synchronizeRequiredFeatures(this); }
87    virtual void synchronizeRequiredExtensions() { SVGTests::synchronizeRequiredExtensions(this); }
88    virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }
89};
90
91} // namespace WebCore
92
93#endif // ENABLE(SVG)
94#endif
95