mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 05:07:35 +00:00
LibWeb: Add a getter for the default image bitmap of HTMLImageElement
The default image bitmap is the first frame for animated bitmaps, and the only frame for non-animated bitmaps.
This commit is contained in:
parent
9b11e0051c
commit
cc0496284b
Notes:
github-actions[bot]
2025-08-03 19:49:21 +00:00
Author: https://github.com/IdanHo
Commit: cc0496284b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5695
Reviewed-by: https://github.com/gmta ✅
2 changed files with 8 additions and 0 deletions
|
@ -173,6 +173,13 @@ RefPtr<Gfx::ImmutableBitmap> HTMLImageElement::immutable_bitmap() const
|
|||
return current_image_bitmap();
|
||||
}
|
||||
|
||||
RefPtr<Gfx::ImmutableBitmap> HTMLImageElement::default_image_bitmap(Gfx::IntSize size) const
|
||||
{
|
||||
if (auto data = m_current_request->image_data())
|
||||
return data->bitmap(0, size);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool HTMLImageElement::is_image_available() const
|
||||
{
|
||||
return m_current_request && m_current_request->is_available();
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
String alt() const { return get_attribute_value(HTML::AttributeNames::alt); }
|
||||
|
||||
RefPtr<Gfx::ImmutableBitmap> immutable_bitmap() const;
|
||||
RefPtr<Gfx::ImmutableBitmap> default_image_bitmap(Gfx::IntSize = {}) const;
|
||||
|
||||
WebIDL::UnsignedLong width() const;
|
||||
WebIDL::ExceptionOr<void> set_width(WebIDL::UnsignedLong);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue