summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Loader/ImageLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibWeb/Loader/ImageLoader.cpp')
-rw-r--r--Libraries/LibWeb/Loader/ImageLoader.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Libraries/LibWeb/Loader/ImageLoader.cpp b/Libraries/LibWeb/Loader/ImageLoader.cpp
index 3732326bf5..b56ab98abd 100644
--- a/Libraries/LibWeb/Loader/ImageLoader.cpp
+++ b/Libraries/LibWeb/Loader/ImageLoader.cpp
@@ -39,6 +39,7 @@ ImageLoader::ImageLoader()
void ImageLoader::load(const URL& url)
{
+ m_loading_state = LoadingState::Loading;
LoadRequest request;
request.set_url(url);
set_resource(ResourceLoader::the().load_resource(Resource::Type::Image, request));
@@ -62,11 +63,14 @@ void ImageLoader::resource_did_load()
ASSERT(resource());
if (!resource()->mime_type().starts_with("image/")) {
+ m_loading_state = LoadingState::Failed;
if (on_fail)
on_fail();
return;
}
+ m_loading_state = LoadingState::Loaded;
+
#ifdef IMAGE_LOADER_DEBUG
if (!resource()->has_encoded_data()) {
dbg() << "ImageLoader: Resource did load, no encoded data. URL: " << resource()->url();
@@ -118,6 +122,7 @@ void ImageLoader::animate()
void ImageLoader::resource_did_fail()
{
dbg() << "ImageLoader: Resource did fail. URL: " << resource()->url();
+ m_loading_state = LoadingState::Failed;
if (on_fail)
on_fail();
}