mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
LibWeb: Flexbox: Resolve relative size of flex-items more correctly
This is still very much not the right thing to do, but at least relatively sized flex-items get the right size.
This commit is contained in:
parent
8e3fe80c06
commit
15b61ce143
1 changed files with 9 additions and 1 deletions
|
@ -90,6 +90,14 @@ void FlexFormattingContext::run(Box& box, LayoutMode)
|
||||||
? box.width()
|
? box.width()
|
||||||
: box.height();
|
: box.height();
|
||||||
};
|
};
|
||||||
|
auto specified_main_size_of_child_box = [&is_row, &specified_main_size](Box& box, Box& child_box) {
|
||||||
|
auto main_size_of_parent = specified_main_size(box);
|
||||||
|
if (is_row) {
|
||||||
|
return child_box.computed_values().width().resolved_or_zero(child_box, main_size_of_parent).to_px(child_box);
|
||||||
|
} else {
|
||||||
|
return child_box.computed_values().height().resolved_or_zero(child_box, main_size_of_parent).to_px(child_box);
|
||||||
|
}
|
||||||
|
};
|
||||||
auto specified_cross_size = [&is_row](Box& box) {
|
auto specified_cross_size = [&is_row](Box& box) {
|
||||||
return is_row
|
return is_row
|
||||||
? box.height()
|
? box.height()
|
||||||
|
@ -313,7 +321,7 @@ void FlexFormattingContext::run(Box& box, LayoutMode)
|
||||||
// FIXME: This is probably too naive.
|
// FIXME: This is probably too naive.
|
||||||
// FIXME: Care about FlexBasis::Auto
|
// FIXME: Care about FlexBasis::Auto
|
||||||
if (has_definite_main_size(child_box)) {
|
if (has_definite_main_size(child_box)) {
|
||||||
flex_item.flex_base_size = specified_main_size(child_box);
|
flex_item.flex_base_size = specified_main_size_of_child_box(box, child_box);
|
||||||
} else {
|
} else {
|
||||||
layout_for_maximum_main_size(child_box);
|
layout_for_maximum_main_size(child_box);
|
||||||
flex_item.flex_base_size = calculated_main_size(child_box);
|
flex_item.flex_base_size = calculated_main_size(child_box);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue