From e159370ccb7ebe0ddea927cfd8864b76204bbc4c Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sat, 25 Apr 2020 14:24:26 +0100 Subject: [PATCH] LibWeb: Handle .gifs as images and use ImageDecoder to decode them --- Libraries/LibWeb/HtmlView.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Libraries/LibWeb/HtmlView.cpp b/Libraries/LibWeb/HtmlView.cpp index fbae7946de..5092d61b6a 100644 --- a/Libraries/LibWeb/HtmlView.cpp +++ b/Libraries/LibWeb/HtmlView.cpp @@ -27,11 +27,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -317,7 +317,8 @@ static RefPtr create_image_document(const ByteBuffer& data, const URL& { auto document = adopt(*new Document(url)); - auto bitmap = Gfx::load_png_from_memory(data.data(), data.size()); + auto image_decoder = Gfx::ImageDecoder::create(data.data(), data.size()); + auto bitmap = image_decoder->bitmap(); ASSERT(bitmap); auto html_element = create_element(document, "html"); @@ -366,7 +367,7 @@ void HtmlView::load(const URL& url) } RefPtr document; - if (url.path().ends_with(".png")) { + if (url.path().ends_with(".png") || url.path().ends_with(".gif")) { document = create_image_document(data, url); } else { document = parse_html_document(data, url);