1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

LibWeb+LibWebView+WebContent: Add Web::Platform::ImageCodecPlugin

This replaces the previous Web::ImageDecoding::Decoder interface.
While we're doing this, also move the SerenityOS implementation of this
interface from LibWebView to WebContent. That means we no longer have to
link with LibImageDecoderClient in applications that use a web view.
This commit is contained in:
Andreas Kling 2022-09-16 15:01:47 +02:00
parent 412b2313f3
commit cd7262ee56
14 changed files with 95 additions and 113 deletions

View file

@ -19,10 +19,10 @@
#include <LibWeb/HTML/HTMLIFrameElement.h>
#include <LibWeb/HTML/NavigationParams.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/ImageDecoding.h>
#include <LibWeb/Loader/FrameLoader.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Page/Page.h>
#include <LibWeb/Platform/ImageCodecPlugin.h>
#include <LibWeb/XML/XMLDocumentBuilder.h>
namespace Web {
@ -82,7 +82,7 @@ static bool build_text_document(DOM::Document& document, ByteBuffer const& data)
static bool build_image_document(DOM::Document& document, ByteBuffer const& data)
{
auto image = ImageDecoding::Decoder::the().decode_image(data);
auto image = Platform::ImageCodecPlugin::the().decode_image(data);
if (!image.has_value() || image->frames.is_empty())
return false;
auto const& frame = image->frames[0];
@ -215,7 +215,7 @@ bool FrameLoader::load(LoadRequest& request, Type type)
if (data.is_empty())
return;
RefPtr<Gfx::Bitmap> favicon_bitmap;
auto decoded_image = ImageDecoding::Decoder::the().decode_image(data);
auto decoded_image = Platform::ImageCodecPlugin::the().decode_image(data);
if (!decoded_image.has_value() || decoded_image->frames.is_empty()) {
dbgln("Could not decode favicon {}", favicon_url);
} else {