Chromium Code Reviews| Index: Source/core/loader/ImageLoader.cpp |
| diff --git a/Source/core/loader/ImageLoader.cpp b/Source/core/loader/ImageLoader.cpp |
| index c89b49fc21096ea00e9107972d5d4a97d6f7eba7..cbf21345934a8b820f37918559a9a6d88ce9040e 100644 |
| --- a/Source/core/loader/ImageLoader.cpp |
| +++ b/Source/core/loader/ImageLoader.cpp |
| @@ -120,6 +120,7 @@ ImageLoader::ImageLoader(Element* element) |
| , m_imageComplete(true) |
| , m_loadingImageDocument(false) |
| , m_elementIsProtected(false) |
| + , m_environmentChangeOnly(false) |
| , m_highPriorityClientCount(0) |
| { |
| WTF_LOG(Timers, "new ImageLoader %p", this); |
| @@ -308,6 +309,9 @@ void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, Up |
| toRenderImage(m_element->renderer())->intrinsicSizeChanged(); |
| } |
| + if (updateBehavior == UpdateSizeChanged) |
| + m_environmentChangeOnly = true; |
|
Mike West
2014/10/17 14:12:40
You can drop the `if` and just assign the result o
|
| + |
| if (RenderImageResource* imageResource = renderImageResource()) |
| imageResource->resetAnimation(); |
| @@ -318,6 +322,7 @@ void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, Up |
| void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior, LoadType loadType) |
| { |
| + m_environmentChangeOnly = false; |
| AtomicString imageSourceURL = m_element->imageSourceURL(); |
| if (updateBehavior == UpdateIgnorePreviousError) |
| @@ -386,8 +391,12 @@ void ImageLoader::notifyFinished(Resource* resource) |
| loadEventSender().cancelEvent(this); |
| m_hasPendingLoadEvent = false; |
| - m_hasPendingErrorEvent = true; |
| - errorEventSender().dispatchEventSoon(this); |
| + // The error event should not fire if the image data update is a result of environment change. |
| + // https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:the-img-element-55 |
| + if (!m_environmentChangeOnly) { |
| + m_hasPendingErrorEvent = true; |
| + errorEventSender().dispatchEventSoon(this); |
| + } |
| // Only consider updating the protection ref-count of the Element immediately before returning |
| // from this function as doing so might result in the destruction of this ImageLoader. |