mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02: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:
Notes:
sideshowbarker
2024-07-17 02:56:25 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c648e24cff Pull-request: https://github.com/SerenityOS/serenity/pull/18783 Issue: https://github.com/SerenityOS/serenity/issues/17976 Reviewed-by: https://github.com/trflynn89
@@ -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