| Index: third_party/WebKit/Source/core/html/HTMLImageLoader.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp b/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp
|
| index fdaa2f14c09f07a3625b72fbabb0379c84565fc1..ad61807a7ba76f79f6a9995ce113c608c1588974 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp
|
| @@ -24,6 +24,7 @@
|
| #include "core/HTMLNames.h"
|
| #include "core/dom/Element.h"
|
| #include "core/events/Event.h"
|
| +#include "core/events/EventSender.h"
|
| #include "core/fetch/ImageResource.h"
|
| #include "core/fetch/ResourceLoadingLog.h"
|
| #include "core/html/HTMLImageElement.h"
|
| @@ -35,6 +36,17 @@ namespace blink {
|
|
|
| using namespace HTMLNames;
|
|
|
| +static ImageEventSender& loadendEventSender()
|
| +{
|
| + DEFINE_STATIC_LOCAL(ImageEventSender, sender, (ImageEventSender::create(EventTypeNames::loadend)));
|
| + return sender;
|
| +}
|
| +
|
| +void HTMLImageLoader::dispatchPendingLoadendEvents()
|
| +{
|
| + loadendEventSender().dispatchPendingEvents();
|
| +}
|
| +
|
| HTMLImageLoader::HTMLImageLoader(Element* element)
|
| : ImageLoader(element)
|
| {
|
| @@ -58,6 +70,22 @@ void HTMLImageLoader::dispatchLoadEvent()
|
| element()->dispatchEvent(Event::create(errorOccurred ? EventTypeNames::error : EventTypeNames::load));
|
| }
|
|
|
| +void HTMLImageLoader::dispatchLoadendEvent()
|
| +{
|
| + RESOURCE_LOADING_DVLOG(1) << "HTMLImageLoader::dispatchLoadendEvent " << this;
|
| +
|
| + if (isHTMLImageElement(*element()))
|
| + element()->dispatchEvent(Event::create(EventTypeNames::loadend));
|
| +}
|
| +
|
| +void HTMLImageLoader::dispatchLoadendEventSoon()
|
| +{
|
| + RESOURCE_LOADING_DVLOG(1) << "HTMLImageLoader::dispatchLoadendEventSoon " << this;
|
| +
|
| + if (isHTMLImageElement(*element()))
|
| + loadendEventSender().dispatchEventSoon(this);
|
| +}
|
| +
|
| static void loadFallbackContentForElement(Element* element)
|
| {
|
| if (isHTMLImageElement(element))
|
| @@ -96,6 +124,7 @@ void HTMLImageLoader::imageNotifyFinished(ImageResource*)
|
|
|
| if ((loadError || cachedImage->response().httpStatusCode() >= 400) && isHTMLObjectElement(*element))
|
| toHTMLObjectElement(element)->renderFallbackContent();
|
| + dispatchLoadendEventSoon();
|
| }
|
|
|
| void HTMLImageLoader::ensureFallbackContent()
|
|
|