mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
LibWeb: Fix overeager fallback to stretch-fit width for some flex items
If a flex item has a preferred aspect ratio and the flex basis is not definite, we were falling back to using stretch-fit for the main size, since that appeared to match other browsers. However, we missed the case where we actually have a definite cross size through which the preferred aspect ratio can be naturally resolved.
This commit is contained in:
parent
9c02ace897
commit
db1faef786
Notes:
sideshowbarker
2024-07-17 22:55:25 +09:00
Author: https://github.com/awesomekling
Commit: db1faef786
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/258
3 changed files with 36 additions and 3 deletions
|
@ -639,10 +639,10 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size(
|
|||
|
||||
// AD-HOC: This is not mentioned in the spec, but if the item has an aspect ratio,
|
||||
// we may need to adjust the main size in these ways:
|
||||
// - using stretch-fit main size if the flex basis is indefinite.
|
||||
// - using stretch-fit main size if the flex basis is indefinite and there is no cross size to resolve the ratio against.
|
||||
// - in response to cross size min/max constraints.
|
||||
if (item.box->has_preferred_aspect_ratio()) {
|
||||
if (!item.used_flex_basis_is_definite) {
|
||||
if (item.box->has_natural_aspect_ratio()) {
|
||||
if (!item.used_flex_basis_is_definite && !has_definite_cross_size(item)) {
|
||||
item.flex_base_size = inner_main_size(m_flex_container_state);
|
||||
}
|
||||
item.flex_base_size = adjust_main_size_through_aspect_ratio_for_cross_size_min_max_constraints(child_box, item.flex_base_size, computed_cross_min_size(child_box), computed_cross_max_size(child_box));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue