#ifndef SVGZoomAndPan_h
#define SVGZoomAndPan_h
#if ENABLE(SVG)
#include "Attribute.h"
#include "QualifiedName.h"
#include "SVGNames.h"
#include <wtf/HashSet.h>
#include <wtf/RefCounted.h>
#include <wtf/unicode/Unicode.h>
namespace WebCore {
enum SVGZoomAndPanType {
SVGZoomAndPanUnknown = 0,
SVGZoomAndPanDisable,
SVGZoomAndPanMagnify
};
class SVGZoomAndPan {
public:
enum {
SVG_ZOOMANDPAN_UNKNOWN = SVGZoomAndPanUnknown,
SVG_ZOOMANDPAN_DISABLE = SVGZoomAndPanDisable,
SVG_ZOOMANDPAN_MAGNIFY = SVGZoomAndPanMagnify
};
static bool isKnownAttribute(const QualifiedName&);
static void addSupportedAttributes(HashSet<QualifiedName>&);
static SVGZoomAndPanType parseFromNumber(unsigned short number)
{
if (!number || number > SVGZoomAndPanMagnify)
return SVGZoomAndPanUnknown;
return static_cast<SVGZoomAndPanType>(number);
}
static bool parseZoomAndPan(const UChar*& start, const UChar* end, SVGZoomAndPanType&);
template<class SVGElementTarget>
static bool parseAttribute(SVGElementTarget* target, const QualifiedName& name, const AtomicString& value)
{
ASSERT(target);
ASSERT(target->document());
if (name == SVGNames::zoomAndPanAttr) {
const UChar* start = value.characters();
const UChar* end = start + value.length();
SVGZoomAndPanType zoomAndPan = SVGZoomAndPanUnknown;
parseZoomAndPan(start, end, zoomAndPan);
target->setZoomAndPan(zoomAndPan);
return true;
}
return false;
}
SVGZoomAndPanType zoomAndPan() const { return SVGZoomAndPanUnknown; }
void ref();
void deref();
void setZoomAndPan(unsigned short);
};
}
#endif // ENABLE(SVG)
#endif // SVGZoomAndPan_h