Index: third_party/WebKit/Source/core/fetch/ImageResource.cpp |
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp |
index c08e465ee78fe5722792924a619f9acb8341854e..194fe542182e6c661977f6398f0dc23052b7a3f2 100644 |
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp |
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp |
@@ -375,7 +375,7 @@ void ImageResource::updateImage(bool allDataReceived) |
if (m_data) |
createImage(); |
- bool sizeAvailable = false; |
+ Image::SizeAvailability sizeAvailable = Image::SizeUnavailable; |
// Have the image update its data from its internal buffer. |
// It will not do anything now, but will delay decoding until |
@@ -389,19 +389,20 @@ void ImageResource::updateImage(bool allDataReceived) |
// received all the data or the size is known. Each chunk from the |
// network causes observers to repaint, which will force that chunk |
// to decode. |
- if (sizeAvailable || allDataReceived) { |
- if (!m_image || m_image->isNull()) { |
- if (!errorOccurred()) |
- setStatus(DecodeError); |
- clear(); |
- if (memoryCache()->contains(this)) |
- memoryCache()->remove(this); |
- } |
- |
- // It would be nice to only redraw the decoded band of the image, but with the current design |
- // (decoding delayed until painting) that seems hard. |
- notifyObservers(); |
+ if (sizeAvailable == Image::SizeUnavailable && !allDataReceived) |
+ return; |
+ if (!m_image || m_image->isNull()) { |
+ if (!errorOccurred()) |
+ setStatus(DecodeError); |
+ if (!allDataReceived && m_loader) |
+ m_loader->didFinishLoading(nullptr, monotonicallyIncreasingTime(), encodedSize()); |
+ clear(); |
+ memoryCache()->remove(this); |
} |
+ |
+ // It would be nice to only redraw the decoded band of the image, but with the current design |
+ // (decoding delayed until painting) that seems hard. |
+ notifyObservers(); |
} |
void ImageResource::updateImageAndClearBuffer() |