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

Unified Diff: third_party/WebKit/Source/core/loader/ImageLoader.cpp

Issue 2877583002: Refactor ImageLoader::UpdateFromElement(kUpdateForcedReload) (Closed)
Patch Set: Rebase Created 3 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 | « third_party/WebKit/Source/core/loader/ImageLoader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/ImageLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
index 54217197d1366496b31b96266428b4b320aabf37..74f02520228e0228d8772d8930f9f31b99fff916 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -425,12 +425,21 @@ void ImageLoader::UpdateFromElement(UpdateFromElementBehavior update_behavior,
if (!failed_load_url_.IsEmpty() && image_source_url == failed_load_url_)
return;
+ if (loading_image_document_ && update_behavior == kUpdateForcedReload) {
+ // Prepares for reloading ImageDocument.
+ // We turn the ImageLoader into non-ImageDocument here, and proceed to
+ // reloading just like an ordinary <img> element below.
+ loading_image_document_ = false;
+ image_resource_for_image_document_ = nullptr;
+ ClearImage();
+ }
+
// Prevent the creation of a ResourceLoader (and therefore a network request)
// for ImageDocument loads. In this case, the image contents have already been
// requested as a main resource and ImageDocumentParser will take care of
// funneling the main resource bytes into image_, so just create an
// ImageResource to be populated later.
- if (loading_image_document_ && update_behavior != kUpdateForcedReload) {
+ if (loading_image_document_) {
ImageResource* image_resource = ImageResource::Create(
ResourceRequest(ImageSourceToKURL(element_->ImageSourceURL())));
image_resource->SetStatus(ResourceStatus::kPending);
« no previous file with comments | « third_party/WebKit/Source/core/loader/ImageLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698