SVGImageLoader.cpp [plain text]
#include "config.h"
#include "SVGImageLoader.h"
#include "CachedImage.h"
#include "Event.h"
#include "EventNames.h"
#include "HTMLParserIdioms.h"
#include "SVGImageElement.h"
namespace WebCore {
SVGImageLoader::SVGImageLoader(SVGImageElement& element)
: ImageLoader(element)
{
}
SVGImageLoader::~SVGImageLoader()
{
}
void SVGImageLoader::dispatchLoadEvent()
{
if (image()->errorOccurred())
element().dispatchEvent(Event::create(eventNames().errorEvent, false, false));
else {
if (downcast<SVGImageElement>(element()).externalResourcesRequiredBaseValue())
downcast<SVGImageElement>(ImageLoader::element()).sendSVGLoadEventIfPossible(true);
}
}
String SVGImageLoader::sourceURI(const AtomicString& attribute) const
{
URL base = element().baseURI();
if (base.isValid())
return URL(base, stripLeadingAndTrailingHTMLSpaces(attribute)).string();
return element().document().completeURL(stripLeadingAndTrailingHTMLSpaces(attribute));
}
}