Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Unified Diff: Source/core/fetch/ImageResource.cpp

Issue 1154413002: Make multipart image documents work again. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix excessive clumsiness Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/ImageResource.h ('k') | Source/core/fetch/ImageResourceTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/ImageResource.cpp
diff --git a/Source/core/fetch/ImageResource.cpp b/Source/core/fetch/ImageResource.cpp
index b862eb800d4871dedc829b30431e3bbdf3db5e29..148082b3acea4382870eaaba98be9d46295c5490 100644
--- a/Source/core/fetch/ImageResource.cpp
+++ b/Source/core/fetch/ImageResource.cpp
@@ -29,6 +29,7 @@
#include "core/fetch/ResourceClient.h"
#include "core/fetch/ResourceClientWalker.h"
#include "core/fetch/ResourceFetcher.h"
+#include "core/fetch/ResourceLoader.h"
#include "core/html/HTMLImageElement.h"
#include "core/layout/LayoutObject.h"
#include "core/svg/graphics/SVGImage.h"
@@ -47,7 +48,6 @@ ImageResource::ImageResource(const ResourceRequest& resourceRequest)
: Resource(resourceRequest, Image)
, m_devicePixelRatioHeaderValue(1.0)
, m_image(nullptr)
- , m_loadingMultipartContent(false)
, m_hasDevicePixelRatioHeaderValue(false)
{
WTF_LOG(Timers, "new ImageResource(ResourceRequest) %p", this);
@@ -59,7 +59,6 @@ ImageResource::ImageResource(blink::Image* image)
: Resource(ResourceRequest(""), Image)
, m_devicePixelRatioHeaderValue(1.0)
, m_image(image)
- , m_loadingMultipartContent(false)
, m_hasDevicePixelRatioHeaderValue(false)
{
WTF_LOG(Timers, "new ImageResource(Image) %p", this);
@@ -318,7 +317,7 @@ inline void ImageResource::clearImage()
void ImageResource::appendData(const char* data, unsigned length)
{
Resource::appendData(data, length);
- if (!m_loadingMultipartContent)
+ if (!loadingMultipartContent())
updateImage(false);
}
@@ -357,10 +356,10 @@ void ImageResource::updateImage(bool allDataReceived)
void ImageResource::finishOnePart()
{
- if (m_loadingMultipartContent)
+ if (loadingMultipartContent())
clear();
updateImage(true);
- if (m_loadingMultipartContent)
+ if (loadingMultipartContent())
m_data.clear();
Resource::finishOnePart();
}
@@ -374,10 +373,8 @@ void ImageResource::error(Resource::Status status)
void ImageResource::responseReceived(const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle)
{
- if (m_loadingMultipartContent && m_data)
+ if (loadingMultipartContent() && m_data)
finishOnePart();
- else if (response.isMultipart())
- m_loadingMultipartContent = true;
if (RuntimeEnabledFeatures::clientHintsEnabled()) {
m_devicePixelRatioHeaderValue = response.httpHeaderField("content-dpr").toFloat(&m_hasDevicePixelRatioHeaderValue);
if (!m_hasDevicePixelRatioHeaderValue || m_devicePixelRatioHeaderValue <= 0.0) {
@@ -516,4 +513,9 @@ Image* ImageResource::svgImageForLayoutObject(const LayoutObject* layoutObject)
return imageForContainer.get();
}
+bool ImageResource::loadingMultipartContent() const
+{
+ return m_loader && m_loader->loadingMultipartContent();
+}
+
} // namespace blink
« no previous file with comments | « Source/core/fetch/ImageResource.h ('k') | Source/core/fetch/ImageResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698