mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:17:35 +00:00
LibWeb: Fix a case of incorrect flex container max-content main size
We were incorrectly returning a "specified size suggestion" for flex items with a definite main size where that main size was also automatic. This led to us incorrectly choosing 0 as the automatic minimum size for that flex item, instead of its min-content size.
This commit is contained in:
parent
cb912f0e1a
commit
a5f8f8238f
3 changed files with 23 additions and 1 deletions
|
@ -0,0 +1,8 @@
|
||||||
|
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||||
|
BlockContainer <html> at (1,1) content-size 798x68 [BFC] children: not-inline
|
||||||
|
Box <body.flex> at (10,10) content-size 38.84375x50 flex-container(row) [FFC] children: not-inline
|
||||||
|
BlockContainer <div.item> at (11,11) content-size 36.84375x48 flex-item [BFC] children: inline
|
||||||
|
line 0 width: 36.84375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||||
|
frag 0 from TextNode start: 0, length: 5, rect: [11,11 36.84375x17.46875]
|
||||||
|
"hello"
|
||||||
|
TextNode <#text>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!doctype html><style>
|
||||||
|
* { border: 1px solid black; }
|
||||||
|
html { background: white; }
|
||||||
|
.flex {
|
||||||
|
width: max-content;
|
||||||
|
display: flex;
|
||||||
|
background: pink;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
flex-basis: 1px;
|
||||||
|
background: orange;
|
||||||
|
}
|
||||||
|
</style><body class="flex"><div class="item">hello
|
|
@ -750,7 +750,7 @@ Optional<CSSPixels> FlexFormattingContext::specified_size_suggestion(FlexItem co
|
||||||
{
|
{
|
||||||
// If the item’s preferred main size is definite and not automatic,
|
// If the item’s preferred main size is definite and not automatic,
|
||||||
// then the specified size suggestion is that size. It is otherwise undefined.
|
// then the specified size suggestion is that size. It is otherwise undefined.
|
||||||
if (has_definite_main_size(item.box)) {
|
if (has_definite_main_size(item.box) && !should_treat_main_size_as_auto(item.box)) {
|
||||||
// NOTE: We use get_pixel_{width,height} to ensure that CSS box-sizing is respected.
|
// NOTE: We use get_pixel_{width,height} to ensure that CSS box-sizing is respected.
|
||||||
return is_row_layout() ? get_pixel_width(item.box, computed_main_size(item.box)) : get_pixel_height(item.box, computed_main_size(item.box));
|
return is_row_layout() ? get_pixel_width(item.box, computed_main_size(item.box)) : get_pixel_height(item.box, computed_main_size(item.box));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue