mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-10 10:36:30 +00:00
LibWeb: Make ImageBox ask ImageProvider for intrinsic size and ratio
This paves the way for ImageProvider to have something vector-based underneath. :^)
This commit is contained in:
@@ -350,6 +350,27 @@ i32 HTMLObjectElement::default_tab_index_value() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
Optional<CSSPixels> HTMLObjectElement::intrinsic_width() const
|
||||
{
|
||||
if (m_image_loader.has_value())
|
||||
return m_image_loader->bitmap(0)->width();
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<CSSPixels> HTMLObjectElement::intrinsic_height() const
|
||||
{
|
||||
if (m_image_loader.has_value())
|
||||
return m_image_loader->bitmap(0)->height();
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<float> HTMLObjectElement::intrinsic_aspect_ratio() const
|
||||
{
|
||||
if (m_image_loader.has_value())
|
||||
return static_cast<float>(m_image_loader->bitmap(0)->width()) / static_cast<float>(m_image_loader->bitmap(0)->height());
|
||||
return {};
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Bitmap const> HTMLObjectElement::current_image_bitmap() const
|
||||
{
|
||||
if (m_image_loader.has_value())
|
||||
|
||||
Reference in New Issue
Block a user