1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 10:14:58 +00:00

LibWeb: Don't force HTMLImageElement to have a legacy ImageLoader

We achieve this by adding a new Layout::ImageProvider class and having
both HTMLImageElement and HTMLObjectElement inherit from it.

The HTML spec is vague on how object image loading should work, which
is why this first pass is focusing on image elements.
This commit is contained in:
Andreas Kling 2023-05-12 07:17:01 +02:00
parent 3cf73ca0b3
commit c648e24cff
9 changed files with 84 additions and 88 deletions

View file

@ -11,6 +11,7 @@
#include <LibWeb/HTML/FormAssociatedElement.h>
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/NavigableContainer.h>
#include <LibWeb/Layout/ImageProvider.h>
#include <LibWeb/Loader/ImageLoader.h>
namespace Web::HTML {
@ -18,7 +19,8 @@ namespace Web::HTML {
class HTMLObjectElement final
: public NavigableContainer
, public FormAssociatedElement
, public ResourceClient {
, public ResourceClient
, public Layout::ImageProvider {
WEB_PLATFORM_OBJECT(HTMLObjectElement, NavigableContainer)
FORM_ASSOCIATED_ELEMENT(NavigableContainer, HTMLObjectElement)
@ -67,6 +69,10 @@ private:
// ^DOM::Element
virtual i32 default_tab_index_value() const override;
// ^Layout::ImageProvider
virtual RefPtr<Gfx::Bitmap const> current_image_bitmap() const override;
virtual void set_visible_in_viewport(bool) override;
Representation m_representation { Representation::Unknown };
Optional<ImageLoader> m_image_loader;
};