mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +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:
@@ -76,7 +76,7 @@ JS::GCPtr<Layout::Node> HTMLObjectElement::create_layout_node(NonnullRefPtr<CSS:
|
||||
return nullptr;
|
||||
case Representation::Image:
|
||||
if (m_image_loader.has_value() && m_image_loader->has_image())
|
||||
return heap().allocate_without_realm<Layout::ImageBox>(document(), *this, move(style), *m_image_loader);
|
||||
return heap().allocate_without_realm<Layout::ImageBox>(document(), *this, move(style), *this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -350,4 +350,16 @@ i32 HTMLObjectElement::default_tab_index_value() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Bitmap const> HTMLObjectElement::current_image_bitmap() const
|
||||
{
|
||||
if (m_image_loader.has_value())
|
||||
return m_image_loader->bitmap(m_image_loader->current_frame_index());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void HTMLObjectElement::set_visible_in_viewport(bool)
|
||||
{
|
||||
// FIXME: Loosen grip on image data when it's not visible, e.g via volatile memory.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user