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

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

Issue 481753002: Use Shadow DOM to display fallback content for images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 3 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: Source/core/loader/ImageLoader.cpp
diff --git a/Source/core/loader/ImageLoader.cpp b/Source/core/loader/ImageLoader.cpp
index a93ef263032e3ac86928e438f3d796cce8c92969..3e51b8d8ef6977f5e1c3404011295fde442c0b60 100644
--- a/Source/core/loader/ImageLoader.cpp
+++ b/Source/core/loader/ImageLoader.cpp
@@ -272,8 +272,11 @@ void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, Up
// Fire an error event if the url string is not empty, but the KURL is.
m_hasPendingErrorEvent = true;
errorEventSender().dispatchEventSoon(this);
+ } else {
+ noImageResourceToLoad();
}
+
ImageResource* oldImage = m_image.get();
if (newImage != oldImage) {
sourceImageChanged();
@@ -334,7 +337,7 @@ void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior, Lo
}
KURL url = imageSourceToKURL(imageSourceURL);
- if (imageSourceURL.isNull() || url.isNull() || shouldLoadImmediately(url, loadType)) {
+ if ((!imageSourceURL.isNull() && url.isNull()) || shouldLoadImmediately(url, loadType)) {
doUpdateFromElement(DoNotBypassMainWorldCSP, updateBehavior);
return;
}
@@ -364,7 +367,8 @@ bool ImageLoader::shouldLoadImmediately(const KURL& url, LoadType loadType) cons
|| isHTMLObjectElement(m_element)
|| isHTMLEmbedElement(m_element)
|| url.protocolIsData()
- || memoryCache()->resourceForURL(url)
+ || !element()->document().frame()
+ || (!url.isNull() && memoryCache()->resourceForURL(url))
|| loadType == ForceLoadImmediately);
}

Powered by Google App Engine
This is Rietveld 408576698