LibWeb: Treat min{max}-height as none if available is intrinsic [GFC]

Fixes infinite recursion in following cases:
- max-height: fit-content
- max-height: min-content
- max-height: max-content
This commit is contained in:
Aliaksandr Kalenik 2024-12-03 20:09:23 +01:00 committed by Andreas Kling
parent 9dad8f55a4
commit bfdf52701f
Notes: github-actions[bot] 2024-12-03 22:10:55 +00:00
3 changed files with 25 additions and 0 deletions

View file

@ -1965,6 +1965,12 @@ bool FormattingContext::should_treat_max_height_as_none(Box const& box, Availabl
if (!m_state.get(*box.non_anonymous_containing_block()).has_definite_height())
return true;
}
if (max_height.is_fit_content() && available_height.is_intrinsic_sizing_constraint())
return true;
if (max_height.is_max_content() && available_height.is_max_content())
return true;
if (max_height.is_min_content() && available_height.is_min_content())
return true;
return false;
}

View file

@ -0,0 +1,13 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x33 [BFC] children: not-inline
Box <body> at (8,8) content-size 784x17 [GFC] children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 784x17 [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 800x33]
PaintableBox (Box<BODY>) [8,8 784x17]
PaintableWithLines (BlockContainer(anonymous)) [8,8 784x17]
TextPaintable (TextNode<#text>)

View file

@ -0,0 +1,6 @@
<!doctype html><style>
body {
display: grid;
max-height: fit-content;
}
</style>hello