mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-25 03:36:36 +00:00
LibWeb: Account for natural aspect ratio in calculate_min_content_height
By the time we calculate the min-content height, the width is already known, so we can use it to calculate the height based on the natural aspect ratio.
This commit is contained in:
parent
44d2e22b93
commit
8d9920af16
Notes:
github-actions[bot]
2025-07-08 20:36:08 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 8d9920af16
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5358
Reviewed-by: https://github.com/awesomekling ✅
4 changed files with 29 additions and 5 deletions
|
@ -1513,8 +1513,11 @@ CSSPixels FormattingContext::calculate_min_content_height(Layout::Box const& box
|
|||
if (box.is_block_container() || box.display().is_table_inside())
|
||||
return calculate_max_content_height(box, width);
|
||||
|
||||
if (box.has_natural_height())
|
||||
if (box.has_natural_height()) {
|
||||
if (box.has_natural_aspect_ratio())
|
||||
return width / *box.natural_aspect_ratio();
|
||||
return *box.natural_height();
|
||||
}
|
||||
|
||||
auto& cache = box.cached_intrinsic_sizes().min_content_height.ensure(width);
|
||||
if (cache.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue