#include "config.h"
#include "SVGZoomAndPan.h"
namespace WebCore {
SVGZoomAndPan::SVGZoomAndPan()
{
registerAttributes();
}
void SVGZoomAndPan::registerAttributes()
{
auto& registry = attributeRegistry();
if (!registry.isEmpty())
return;
registry.registerAttribute<SVGNames::zoomAndPanAttr, &SVGZoomAndPan::m_zoomAndPan>();
}
bool SVGZoomAndPan::parseZoomAndPan(const UChar*& start, const UChar* end)
{
static const UChar disable[] = { 'd', 'i', 's', 'a', 'b', 'l', 'e' };
if (skipString(start, end, disable, WTF_ARRAY_LENGTH(disable))) {
m_zoomAndPan.setValue(SVGZoomAndPanDisable);
return true;
}
static const UChar magnify[] = { 'm', 'a', 'g', 'n', 'i', 'f', 'y' };
if (skipString(start, end, magnify, WTF_ARRAY_LENGTH(magnify))) {
m_zoomAndPan.setValue(SVGZoomAndPanMagnify);
return true;
}
return false;
}
void SVGZoomAndPan::parseAttribute(const QualifiedName& attributeName, const AtomicString& value)
{
if (attributeName != SVGNames::zoomAndPanAttr)
return;
m_zoomAndPan.setValue(SVGPropertyTraits<SVGZoomAndPanType>::fromString(value));
}
}