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() = default;
void SVGImageLoader::dispatchLoadEvent()
{
if (image()->errorOccurred())
element().dispatchEvent(Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::No));
else
downcast<SVGImageElement>(ImageLoader::element()).sendLoadEventIfPossible();
}
String SVGImageLoader::sourceURI(const AtomString& attribute) const
{
URL base = element().baseURI();
if (base != aboutBlankURL())
return URL(base, stripLeadingAndTrailingHTMLSpaces(attribute)).string();
return element().document().completeURL(stripLeadingAndTrailingHTMLSpaces(attribute)).string();
}
}