1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

LibWeb: Generalize ImageBox and ImagePaintable for any ImageProvider

They currently assume the DOM node is an HTMLImageElement with respect
to handling the alt attribute. The HTMLInputElement will require the
same behavior.
This commit is contained in:
Timothy Flynn 2024-02-18 20:10:37 -05:00 committed by Andreas Kling
parent c4295edc81
commit 45a47cb32b
10 changed files with 45 additions and 8 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <LibGfx/Size.h>
#include <LibWeb/Forward.h>
#include <LibWeb/PixelUnits.h>
namespace Web::Layout {
@ -15,12 +16,17 @@ class ImageProvider {
public:
virtual ~ImageProvider() { }
virtual bool is_image_available() const = 0;
virtual Optional<CSSPixels> intrinsic_width() const = 0;
virtual Optional<CSSPixels> intrinsic_height() const = 0;
virtual Optional<CSSPixelFraction> intrinsic_aspect_ratio() const = 0;
virtual RefPtr<Gfx::ImmutableBitmap> current_image_bitmap(Gfx::IntSize) const = 0;
virtual void set_visible_in_viewport(bool) = 0;
protected:
static void did_update_alt_text(ImageBox&);
};
}