mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +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:
parent
3cf73ca0b3
commit
c648e24cff
Notes:
sideshowbarker
2024-07-17 02:56:25 +09:00
Author: https://github.com/awesomekling
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
9 changed files with 84 additions and 88 deletions
|
@ -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.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue