From 5e24b9727580a8b66c99d295802905727ee5200c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 11 Jul 2023 07:53:09 +0200 Subject: [PATCH] LibWeb: Implement HTMLImageElement.complete according to spec Now that we use the HTML image loading algorithm from spec, we can implement complete correctly. This (finally) fixes an issue where images were not loading on https://twinings.co.uk/ :^) --- Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 92502b3b9fb..6e85e0e167c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -234,9 +234,11 @@ bool HTMLImageElement::complete() const return true; // - The img element's current request's state is completely available and its pending request is null. + if (m_current_request->state() == ImageRequest::State::CompletelyAvailable && !m_pending_request) + return true; + // - The img element's current request's state is broken and its pending request is null. - // FIXME: This is ad-hoc and should be updated once we are loading images via the Fetch mechanism. - if (auto bitmap = current_image_bitmap()) + if (m_current_request->state() == ImageRequest::State::Broken && !m_pending_request) return true; return false;