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
24 #include "core/SVGNames.h"
25 #include "core/svg/SVGAnimatedEnumeration.h"
26 #include "core/svg/SVGAnimatedTransformList.h"
27 #include "core/svg/SVGElement.h"
28 #include "core/svg/SVGURIReference.h"
29 #include "core/svg/SVGUnitTypes.h"
30 #include "platform/graphics/Gradient.h"
31 #include "platform/heap/Handle.h"
35 enum SVGSpreadMethodType
{
36 SVGSpreadMethodUnknown
= 0,
38 SVGSpreadMethodReflect
,
41 template<> const SVGEnumerationStringEntries
& getStaticStringEntries
<SVGSpreadMethodType
>();
43 class SVGGradientElement
: public SVGElement
,
44 public SVGURIReference
{
45 DEFINE_WRAPPERTYPEINFO();
46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGGradientElement
);
48 Vector
<Gradient::ColorStop
> buildStops();
50 SVGAnimatedTransformList
* gradientTransform() { return m_gradientTransform
.get(); }
51 SVGAnimatedEnumeration
<SVGSpreadMethodType
>* spreadMethod() { return m_spreadMethod
.get(); }
52 SVGAnimatedEnumeration
<SVGUnitTypes::SVGUnitType
>* gradientUnits() { return m_gradientUnits
.get(); }
54 DECLARE_VIRTUAL_TRACE();
57 SVGGradientElement(const QualifiedName
&, Document
&);
59 void svgAttributeChanged(const QualifiedName
&) override
;
62 bool needsPendingResourceHandling() const final
{ return false; }
64 void childrenChanged(const ChildrenChange
&) final
;
66 RefPtrWillBeMember
<SVGAnimatedTransformList
> m_gradientTransform
;
67 RefPtrWillBeMember
<SVGAnimatedEnumeration
<SVGSpreadMethodType
>> m_spreadMethod
;
68 RefPtrWillBeMember
<SVGAnimatedEnumeration
<SVGUnitTypes::SVGUnitType
>> m_gradientUnits
;
71 inline bool isSVGGradientElement(const SVGElement
& element
)
73 return element
.hasTagName(SVGNames::radialGradientTag
) || element
.hasTagName(SVGNames::linearGradientTag
);
76 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGGradientElement
);
80 #endif // SVGGradientElement_h