mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:15:07 +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:
parent
3cf73ca0b3
commit
c648e24cff
9 changed files with 84 additions and 88 deletions
|
@ -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 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue