1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 17:15:09 +00:00

LibWeb: Piggyback on HTML::ImageRequest in HTMLObjectElement

Like the piggybacking in CSS, this is also totally ad-hoc, since there's
no spec to follow.

The code here is weird and definitely sub-optimal as we do a second load
if it turns out the loaded resource is an image, but given that object
elements are rarely used nowadays, I doubt we'll even notice.

That said, we should of course improve this code as we move forward.
This commit is contained in:
Andreas Kling 2023-06-11 16:02:37 +02:00
parent 680fc3f90a
commit a553fe055b
2 changed files with 46 additions and 28 deletions

View file

@ -12,7 +12,7 @@
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/NavigableContainer.h>
#include <LibWeb/Layout/ImageProvider.h>
#include <LibWeb/Loader/ImageLoader.h>
#include <LibWeb/Loader/Resource.h>
namespace Web::HTML {
@ -59,7 +59,7 @@ private:
void run_object_representation_completed_steps(Representation);
void run_object_representation_fallback_steps();
void convert_resource_to_image();
void load_image();
void update_layout_and_child_objects(Representation);
// ^ResourceClient
@ -77,7 +77,10 @@ private:
virtual void set_visible_in_viewport(bool) override;
Representation m_representation { Representation::Unknown };
Optional<ImageLoader> m_image_loader;
RefPtr<DecodedImageData const> image_data() const;
RefPtr<ImageRequest> m_image_request;
};
}