diff --git a/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 13f42b38eab..0760918749c 100644 --- a/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -173,6 +173,13 @@ RefPtr HTMLImageElement::immutable_bitmap() const return current_image_bitmap(); } +RefPtr 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(); diff --git a/Libraries/LibWeb/HTML/HTMLImageElement.h b/Libraries/LibWeb/HTML/HTMLImageElement.h index 8c6c7c32ee7..931d73ace1a 100644 --- a/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -50,6 +50,7 @@ public: String alt() const { return get_attribute_value(HTML::AttributeNames::alt); } RefPtr immutable_bitmap() const; + RefPtr default_image_bitmap(Gfx::IntSize = {}) const; WebIDL::UnsignedLong width() const; WebIDL::ExceptionOr set_width(WebIDL::UnsignedLong);