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

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

Issue 200923002: Post a microtask to load <img> elements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: all tests fixed Created 6 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
« Source/core/html/HTMLImageElement.cpp ('K') | « 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: Source/core/loader/ImageLoader.cpp
diff --git a/Source/core/loader/ImageLoader.cpp b/Source/core/loader/ImageLoader.cpp
index f177dd996f833c9b8ce095731bff8715c335309c..e18333b930c7e7d03f9670adeb637e1bfc993ea1 100644
--- a/Source/core/loader/ImageLoader.cpp
+++ b/Source/core/loader/ImageLoader.cpp
@@ -28,6 +28,7 @@
#include "core/events/EventSender.h"
#include "core/fetch/CrossOriginAccessControl.h"
#include "core/fetch/FetchRequest.h"
+#include "core/fetch/MemoryCache.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/html/HTMLObjectElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
@@ -223,6 +224,24 @@ void ImageLoader::updateFromElementIgnoringPreviousError()
updateFromElement();
}
+bool ImageLoader::shouldLoadImmediately() const
+{
+ if (m_loadManually)
+ return true;
+
+ AtomicString attr = m_element->imageSourceURL();
+ if (attr.isNull() || stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) {
+ return true;
+ }
+
+ KURL url = m_element->document().completeURL(sourceURI(attr));
+ if (url.protocolIsData())
+ return true;
abarth-chromium 2014/04/01 23:57:14 Why are data URLs special?
+ if (memoryCache()->resourceForURL(url))
+ return true;
+ return false;
+}
+
void ImageLoader::notifyFinished(Resource* resource)
{
ASSERT(m_failedLoadURL.isEmpty());
« Source/core/html/HTMLImageElement.cpp ('K') | « Source/core/loader/ImageLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698