Chromium Code Reviews| 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 7521cbd249b6b29bee79116b9984087a32cb6690..00f09b7411449516327ef0319753fa66abd7769d 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().string()); |
| body->appendChild(m_imageElement.get()); |
| + if (loader()) |
| + m_imageElement->cachedImage()->responseReceived(loader()->response(), nullptr); |
|
Nate Chapin
2016/03/01 19:02:15
Why is this necessary?
yhirano
2016/03/01 19:43:23
The cachedImage response is ignorant of the mime t
Nate Chapin
2016/03/01 19:56:45
Ok.
|
| 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 |