SVGURIReference.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "SVGURIReference.h"
#include "SVGNames.h"
#include "SVGStyledElement.h"
#include "XLinkNames.h"
namespace WebCore {
SVGURIReference::SVGURIReference()
{
}
SVGURIReference::~SVGURIReference()
{
}
ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGURIReference, String, String, string, Href, href, XLinkNames::hrefAttr, m_href)
bool SVGURIReference::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name().matches(XLinkNames::hrefAttr)) {
setHrefBaseValue(attr->value());
return true;
}
return false;
}
bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName)
{
return attrName.matches(XLinkNames::hrefAttr);
}
String SVGURIReference::getTarget(const String& url)
{
if (url.startsWith("url(")) { unsigned int start = url.find('#') + 1;
unsigned int end = url.reverseFind(')');
return url.substring(start, end - start);
} else if (url.find('#') > -1) { unsigned int start = url.find('#') + 1;
return url.substring(start, url.length() - start);
} else return url;
}
}
#endif // ENABLE(SVG)