mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 02:29:21 +00:00
LibWeb: Resolve flex item % main size to 0 during min-content sizing
When the flex container is sized under a min-content constraint in the main axis, any flex items with a percentage main size should collapse to zero width, not take up their own intrinsic min-content size. This is not in the spec, but matches how other browsers behave. Fixes an issue where the cartoons on https://basecamp.com/ were way too large. :^)
This commit is contained in:
parent
1a78edb8c9
commit
59ed823724
Notes:
github-actions[bot]
2024-10-06 14:04:52 +00:00
Author: https://github.com/awesomekling
Commit: 59ed823724
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1650
3 changed files with 37 additions and 0 deletions
|
@ -587,6 +587,13 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size(
|
|||
return get_pixel_height(child_box, size);
|
||||
}
|
||||
|
||||
// AD-HOC: If we're sizing the flex container under a min-content constraint in the main axis,
|
||||
// flex items resolve percentages in the main axis to 0.
|
||||
if (m_available_space_for_items->main.is_min_content()
|
||||
&& computed_main_size(item.box).contains_percentage()) {
|
||||
return CSSPixels(0);
|
||||
}
|
||||
|
||||
// B. If the flex item has ...
|
||||
// - an intrinsic aspect ratio,
|
||||
// - a used flex basis of content, and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue