diff options
author | Andreas Kling <kling@serenityos.org> | 2023-05-12 07:17:01 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-13 09:08:42 +0200 |
commit | c648e24cff18dfd6d94af3de6dedeade0bbfc18b (patch) | |
tree | 8090d1078d1ee3381f754a538b73562f170660dc /Userland/Libraries/LibWeb/HTML/HTMLImageElement.h | |
parent | 3cf73ca0b35c0e4a9054cb921375c67de23404b1 (diff) | |
download | serenity-c648e24cff18dfd6d94af3de6dedeade0bbfc18b.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLImageElement.h')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLImageElement.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h index c8ff4c83fc..9f408c080d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -14,13 +14,14 @@ #include <LibWeb/HTML/FormAssociatedElement.h> #include <LibWeb/HTML/HTMLElement.h> #include <LibWeb/HTML/SourceSet.h> -#include <LibWeb/Loader/ImageLoader.h> +#include <LibWeb/Layout/ImageProvider.h> namespace Web::HTML { class HTMLImageElement final : public HTMLElement - , public FormAssociatedElement { + , public FormAssociatedElement + , public Layout::ImageProvider { WEB_PLATFORM_OBJECT(HTMLImageElement, HTMLElement); FORM_ASSOCIATED_ELEMENT(HTMLElement, HTMLImageElement) @@ -76,6 +77,10 @@ public: // https://html.spec.whatwg.org/multipage/images.html#upgrade-the-pending-request-to-the-current-request void upgrade_pending_request_to_current_request(); + // ^Layout::ImageProvider + virtual RefPtr<Gfx::Bitmap const> current_image_bitmap() const override; + virtual void set_visible_in_viewport(bool) override; + private: HTMLImageElement(DOM::Document&, DOM::QualifiedName); @@ -94,8 +99,6 @@ private: size_t m_current_frame_index { 0 }; size_t m_loops_completed { 0 }; - ImageLoader m_image_loader; - Optional<DOM::DocumentLoadEventDelayer> m_load_event_delayer; CORSSettingAttribute m_cors_setting { CORSSettingAttribute::NoCORS }; |