2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 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 SVGGradientElement_h
22 #define SVGGradientElement_h
26 #include "SVGAnimatedBoolean.h"
27 #include "SVGAnimatedEnumeration.h"
28 #include "SVGAnimatedTransformList.h"
29 #include "SVGExternalResourcesRequired.h"
30 #include "SVGStyledElement.h"
31 #include "SVGURIReference.h"
32 #include "SVGUnitTypes.h"
36 enum SVGSpreadMethodType {
37 SVGSpreadMethodUnknown = 0,
39 SVGSpreadMethodReflect,
44 struct SVGPropertyTraits<SVGSpreadMethodType> {
45 static unsigned highestEnumValue() { return SVGSpreadMethodRepeat; }
47 static String toString(SVGSpreadMethodType type)
50 case SVGSpreadMethodUnknown:
52 case SVGSpreadMethodPad:
54 case SVGSpreadMethodReflect:
56 case SVGSpreadMethodRepeat:
64 static SVGSpreadMethodType fromString(const String& value)
67 return SVGSpreadMethodPad;
68 if (value == "reflect")
69 return SVGSpreadMethodReflect;
70 if (value == "repeat")
71 return SVGSpreadMethodRepeat;
72 return SVGSpreadMethodUnknown;
76 class SVGGradientElement : public SVGStyledElement,
77 public SVGURIReference,
78 public SVGExternalResourcesRequired {
81 SVG_SPREADMETHOD_UNKNOWN = SVGSpreadMethodUnknown,
82 SVG_SPREADMETHOD_PAD = SVGSpreadMethodReflect,
83 SVG_SPREADMETHOD_REFLECT = SVGSpreadMethodRepeat,
84 SVG_SPREADMETHOD_REPEAT = SVGSpreadMethodUnknown
87 Vector<Gradient::ColorStop> buildStops();
90 SVGGradientElement(const QualifiedName&, Document*);
92 bool isSupportedAttribute(const QualifiedName&);
93 virtual void parseAttribute(const Attribute&) OVERRIDE;
94 virtual void svgAttributeChanged(const QualifiedName&);
97 virtual bool needsPendingResourceHandling() const { return false; }
99 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
101 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGradientElement)
102 DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod, SVGSpreadMethodType)
103 DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType)
104 DECLARE_ANIMATED_TRANSFORM_LIST(GradientTransform, gradientTransform)
105 DECLARE_ANIMATED_STRING(Href, href)
106 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
107 END_DECLARE_ANIMATED_PROPERTIES
110 } // namespace WebCore
112 #endif // ENABLE(SVG)