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

Unified Diff: third_party/WebKit/Source/core/html/ImageDocument.cpp

Issue 1710733002: Move multipart resource handling to core/fetch (2/2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multipart-cleanup
Patch Set: Created 4 years, 9 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
Index: third_party/WebKit/Source/core/html/ImageDocument.cpp
diff --git a/third_party/WebKit/Source/core/html/ImageDocument.cpp b/third_party/WebKit/Source/core/html/ImageDocument.cpp
index 640c1de7586ca4ab7ae8fb70fe46169907e5df11..845152f0d3de10c18d6022ea074d79a59a661c3c 100644
--- a/third_party/WebKit/Source/core/html/ImageDocument.cpp
+++ b/third_party/WebKit/Source/core/html/ImageDocument.cpp
@@ -201,7 +201,7 @@ PassRefPtrWillBeRawPtr<DocumentParser> ImageDocument::createParser()
return ImageDocumentParser::create(this);
}
-void ImageDocument::createDocumentStructure(bool loadingMultipartContent)
+void ImageDocument::createDocumentStructure()
{
RefPtrWillBeRawPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*this);
appendChild(rootElement);
@@ -209,13 +209,6 @@ void ImageDocument::createDocumentStructure(bool loadingMultipartContent)
if (frame())
frame()->loader().dispatchDocumentElementAvailable();
- // Normally, ImageDocument creates an HTMLImageElement that doesn't actually load
- // anything, and the ImageDocument routes the main resource data into the HTMLImageElement's
- // ImageResource. However, the main resource pipeline doesn't know how to handle multipart content.
- // For multipart content, we instead stop streaming data through the main resource and re-request
- // the data directly.
- if (loadingMultipartContent)
- loader()->stopLoading();
RefPtrWillBeRawPtr<HTMLHeadElement> head = HTMLHeadElement::create(*this);
RefPtrWillBeRawPtr<HTMLMetaElement> meta = HTMLMetaElement::create(*this);
@@ -231,12 +224,11 @@ void ImageDocument::createDocumentStructure(bool loadingMultipartContent)
m_imageElement = HTMLImageElement::create(*this);
m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none");
- // If the image is multipart, we neglect to mention to the HTMLImageElement that it's in an
- // ImageDocument, so that it requests the image normally.
- if (!loadingMultipartContent)
- m_imageElement->setLoadingImageDocument();
+ m_imageElement->setLoadingImageDocument();
m_imageElement->setSrc(url().getString());
body->appendChild(m_imageElement.get());
+ if (loader())
+ m_imageElement->cachedImage()->responseReceived(loader()->response(), nullptr);
if (shouldShrinkToFit()) {
// Add event listeners
@@ -249,8 +241,6 @@ void ImageDocument::createDocumentStructure(bool loadingMultipartContent)
rootElement->appendChild(head);
rootElement->appendChild(body);
- if (loadingMultipartContent)
- finishedParsing();
}
float ImageDocument::scale() const
@@ -415,11 +405,10 @@ void ImageDocument::windowSizeChanged(ScaleType type)
ImageResource* ImageDocument::cachedImage()
{
- bool loadingMultipartContent = loader() && loader()->loadingMultipartContent();
if (!m_imageElement)
- createDocumentStructure(loadingMultipartContent);
+ createDocumentStructure();
- return loadingMultipartContent ? nullptr : m_imageElement->cachedImage();
+ return m_imageElement->cachedImage();
}
bool ImageDocument::shouldShrinkToFit() const
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageDocument.h ('k') | third_party/WebKit/Source/core/loader/DocumentLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698