SVGCursorElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "SVGCursorElement.h"
#include "Attr.h"
#include "CachedImage.h"
#include "Document.h"
#include "DocLoader.h"
#include "SVGNames.h"
#include "SVGLength.h"
namespace WebCore {
SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document *doc)
: SVGElement(tagName, doc)
, SVGTests()
, SVGExternalResourcesRequired()
, SVGURIReference()
, CachedResourceClient()
, m_x(0, LengthModeWidth)
, m_y(0, LengthModeHeight)
{
m_cachedImage = 0;
}
SVGCursorElement::~SVGCursorElement()
{
if (m_cachedImage)
m_cachedImage->deref(this);
}
ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
void SVGCursorElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(0, LengthModeWidth, attr->value()));
else if (attr->name() == SVGNames::yAttr)
setYBaseValue(SVGLength(0, LengthModeHeight, attr->value()));
else {
if (SVGTests::parseMappedAttribute(attr))
return;
if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
return;
if (SVGURIReference::parseMappedAttribute(attr)) {
if (m_cachedImage)
m_cachedImage->deref(this);
m_cachedImage = ownerDocument()->docLoader()->requestImage(href());
if (m_cachedImage)
m_cachedImage->ref(this);
return;
}
SVGElement::parseMappedAttribute(attr);
}
}
}
#endif // ENABLE(SVG)