LibWeb: Don't limit available space during early height for inline-flex
There was no need to set an available height constraint when doing early height calculation for inline-flex boxes. It created a situation where the flex containers could wrongly get zero height early, and then resolve percentages against zero instead of the real intrinsic size. Fixes #23942
This commit is contained in:
parent
69d6abc60f
commit
f7e57881ad
Notes:
sideshowbarker
2024-07-16 19:57:55 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/f7e57881ad Pull-request: https://github.com/SerenityOS/serenity/pull/23948 Issue: https://github.com/SerenityOS/serenity/issues/23942
3 changed files with 29 additions and 1 deletions
|
@ -0,0 +1,14 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x216 [BFC] children: inline
|
||||
frag 0 from Box start: 0, length: 0, rect: [8,8 200x200] baseline: 13.296875
|
||||
Box <body> at (8,8) content-size 200x200 flex-container(row) [FFC] children: not-inline
|
||||
BlockContainer <div> at (8,8) content-size 200x200 flex-item [BFC] children: inline
|
||||
frag 0 from TextNode start: 0, length: 5, rect: [8,8 36.84375x17] baseline: 13.296875
|
||||
"hello"
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x216]
|
||||
PaintableBox (Box<BODY>) [8,8 200x200]
|
||||
PaintableWithLines (BlockContainer<DIV>) [8,8 200x200]
|
||||
TextPaintable (TextNode<#text>)
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html><style>
|
||||
* { outline: 1px solid black; }
|
||||
html { background: white; }
|
||||
body {
|
||||
display: inline-flex;
|
||||
background: orange;
|
||||
height: 100%;
|
||||
}
|
||||
div {
|
||||
background: magenta;
|
||||
height: 200px;
|
||||
width: 200px;
|
||||
}
|
||||
</style><body><div>hello
|
|
@ -178,7 +178,7 @@ void InlineFormattingContext::dimension_box_on_line(Box const& box, LayoutMode l
|
|||
|
||||
// NOTE: Flex containers with `auto` height are treated as `max-content`, so we can compute their height early.
|
||||
if (box_state.has_definite_height() || box.display().is_flex_inside())
|
||||
parent().compute_height(box, AvailableSpace(AvailableSize::make_definite(width), AvailableSize::make_definite(m_containing_block_used_values.content_height())));
|
||||
parent().compute_height(box, AvailableSpace(AvailableSize::make_definite(width), AvailableSize::make_indefinite()));
|
||||
|
||||
auto independent_formatting_context = layout_inside(box, layout_mode, box_state.available_inner_space_or_constraints_from(*m_available_space));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue