SVGGradientElement.h [plain text]
#ifndef SVGGradientElement_h
#define SVGGradientElement_h
#include "Gradient.h"
#include "SVGAnimatedBoolean.h"
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedTransformList.h"
#include "SVGElement.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGNames.h"
#include "SVGURIReference.h"
#include "SVGUnitTypes.h"
namespace WebCore {
enum SVGSpreadMethodType {
SVGSpreadMethodUnknown = 0,
SVGSpreadMethodPad,
SVGSpreadMethodReflect,
SVGSpreadMethodRepeat
};
template<>
struct SVGPropertyTraits<SVGSpreadMethodType> {
static unsigned highestEnumValue() { return SVGSpreadMethodRepeat; }
static String toString(SVGSpreadMethodType type)
{
switch (type) {
case SVGSpreadMethodUnknown:
return emptyString();
case SVGSpreadMethodPad:
return "pad";
case SVGSpreadMethodReflect:
return "reflect";
case SVGSpreadMethodRepeat:
return "repeat";
}
ASSERT_NOT_REACHED();
return emptyString();
}
static SVGSpreadMethodType fromString(const String& value)
{
if (value == "pad")
return SVGSpreadMethodPad;
if (value == "reflect")
return SVGSpreadMethodReflect;
if (value == "repeat")
return SVGSpreadMethodRepeat;
return SVGSpreadMethodUnknown;
}
};
class SVGGradientElement : public SVGElement,
public SVGURIReference,
public SVGExternalResourcesRequired {
public:
enum {
SVG_SPREADMETHOD_UNKNOWN = SVGSpreadMethodUnknown,
SVG_SPREADMETHOD_PAD = SVGSpreadMethodReflect,
SVG_SPREADMETHOD_REFLECT = SVGSpreadMethodRepeat,
SVG_SPREADMETHOD_REPEAT = SVGSpreadMethodUnknown
};
Vector<Gradient::ColorStop> buildStops();
protected:
SVGGradientElement(const QualifiedName&, Document&);
bool isSupportedAttribute(const QualifiedName&);
virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
virtual void svgAttributeChanged(const QualifiedName&) override;
private:
virtual bool needsPendingResourceHandling() const override { return false; }
virtual void childrenChanged(const ChildChange&) override;
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGradientElement)
DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod, SVGSpreadMethodType)
DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType)
DECLARE_ANIMATED_TRANSFORM_LIST(GradientTransform, gradientTransform)
DECLARE_ANIMATED_STRING(Href, href)
DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
END_DECLARE_ANIMATED_PROPERTIES
};
void isSVGGradientElement(const SVGGradientElement&); bool isSVGGradientElement(const Node&);
NODE_TYPE_CASTS(SVGGradientElement)
}
#endif