• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2     Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3                   2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 
5     This file is part of the KDE project
6 
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Library General Public
9     License as published by the Free Software Foundation; either
10     version 2 of the License, or (at your option) any later version.
11 
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15     Library General Public License for more details.
16 
17     You should have received a copy of the GNU Library General Public License
18     along with this library; see the file COPYING.LIB.  If not, write to
19     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20     Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef SVGPatternElement_h
24 #define SVGPatternElement_h
25 
26 #if ENABLE(SVG)
27 #include "SVGExternalResourcesRequired.h"
28 #include "SVGFitToViewBox.h"
29 #include "SVGLangSpace.h"
30 #include "SVGPaintServerPattern.h"
31 #include "SVGStyledElement.h"
32 #include "SVGTests.h"
33 #include "SVGTransformList.h"
34 #include "SVGURIReference.h"
35 
36 namespace WebCore {
37 
38     struct PatternAttributes;
39 
40     class SVGLength;
41 
42     class SVGPatternElement : public SVGStyledElement,
43                               public SVGURIReference,
44                               public SVGTests,
45                               public SVGLangSpace,
46                               public SVGExternalResourcesRequired,
47                               public SVGFitToViewBox {
48     public:
49         SVGPatternElement(const QualifiedName&, Document*);
50         virtual ~SVGPatternElement();
51 
isValid()52         virtual bool isValid() const { return SVGTests::isValid(); }
53 
54         virtual void parseMappedAttribute(MappedAttribute*);
55         virtual void svgAttributeChanged(const QualifiedName&);
56         virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
57 
58         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
59         virtual SVGResource* canvasResource();
60 
61     protected:
contextElement()62         virtual const SVGElement* contextElement() const { return this; }
63 
64     private:
65         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::xAttrString, SVGLength, X, x)
66         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::yAttrString, SVGLength, Y, y)
67         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::widthAttrString, SVGLength, Width, width)
68         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::heightAttrString, SVGLength, Height, height)
69         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::patternUnitsAttrString, int, PatternUnits, patternUnits)
70         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::patternContentUnitsAttrString, int, PatternContentUnits, patternContentUnits)
71         ANIMATED_PROPERTY_DECLARATIONS(SVGPatternElement, SVGNames::patternTagString, SVGNames::patternTransformAttrString, SVGTransformList, PatternTransform, patternTransform)
72 
73         mutable RefPtr<SVGPaintServerPattern> m_resource;
74 
75     private:
76         friend class SVGPaintServerPattern;
77         void buildPattern(const FloatRect& targetRect) const;
78 
79         PatternAttributes collectPatternProperties() const;
80     };
81 
82 } // namespace WebCore
83 
84 #endif // ENABLE(SVG)
85 #endif
86