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

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

Issue 2859093003: Change the semantics of ImageLoader::has_pending_load_event_ (Closed)
Patch Set: bug fix 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 efb2bde0845ca1dad5712bc41534ff1f914726d1..49a8cfbfddf11320a29348b0d5cda3ecb3e3342e 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -359,7 +359,6 @@ void ImageLoader::DoUpdateFromElement(BypassMainWorldBehavior bypass_behavior,
}
image_ = new_image;
- has_pending_load_event_ = new_image;
image_complete_ = !new_image;
delay_until_image_notify_finished_ = nullptr;
hiroshige 2017/05/05 19:58:31 Previous: has_pending_load_event_ == true iff new_
@@ -515,12 +514,8 @@ void ImageLoader::ImageNotifyFinished(ImageResourceContent* resource) {
ToSVGImage(image_->GetImage())
->UpdateUseCounters(GetElement()->GetDocument());
- if (loading_image_document_) {
- CHECK(!has_pending_load_event_);
+ if (loading_image_document_)
return;
- }
-
- CHECK(has_pending_load_event_);
hiroshige 2017/05/05 19:58:31 Previous: We assert has_pending_load_event_ == tru
if (resource->ErrorOccurred()) {
LoadEventSender().CancelEvent(this);
@@ -543,6 +538,7 @@ void ImageLoader::ImageNotifyFinished(ImageResourceContent* resource) {
UpdatedHasPendingEvent();
return;
}
+ has_pending_load_event_ = true;
LoadEventSender().DispatchEventSoon(this);
}
@@ -589,7 +585,8 @@ void ImageLoader::UpdatedHasPendingEvent() {
// such an Element wishes for the load to stop when removed from the DOM it
// needs to stop the ImageLoader explicitly.
bool was_protected = element_is_protected_;
- element_is_protected_ = has_pending_load_event_ || has_pending_error_event_;
+ element_is_protected_ = (image_ && !image_complete_) ||
+ has_pending_load_event_ || has_pending_error_event_;
if (was_protected == element_is_protected_)
return;
@@ -625,6 +622,7 @@ void ImageLoader::DispatchPendingLoadEvent() {
return;
CHECK(image_complete_);
has_pending_load_event_ = false;
+ CHECK(image_complete_);
if (GetElement()->GetDocument().GetFrame())
DispatchLoadEvent();
« 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