mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +00:00
LibWeb: Add AbstractImageStyleValue::natural_aspect_ratio()
This commit is contained in:
parent
bbceb155ce
commit
d2c96e213f
Notes:
sideshowbarker
2024-07-17 09:48:50 +09:00
Author: https://github.com/MacDue
Commit: d2c96e213f
Pull-request: https://github.com/SerenityOS/serenity/pull/22508
Issue: https://github.com/SerenityOS/serenity/issues/20992
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/nico
3 changed files with 17 additions and 0 deletions
|
@ -124,6 +124,13 @@ Optional<CSSPixels> ImageStyleValue::natural_height() const
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<CSSPixelFraction> ImageStyleValue::natural_aspect_ratio() const
|
||||
{
|
||||
if (auto image_data = this->image_data())
|
||||
return image_data->intrinsic_aspect_ratio();
|
||||
return {};
|
||||
}
|
||||
|
||||
void ImageStyleValue::paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const
|
||||
{
|
||||
if (auto const* b = bitmap(m_current_frame_index, dest_rect.size().to_type<int>()); b != nullptr) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue