LibWeb: When solving abspos lengths, use min max constrained height

Solving using the unconstrained height, when solving for bottom, would
either leave a gap over overflow its container.
This commit is contained in:
BenJilks 2024-07-10 17:39:06 +01:00 committed by Andreas Kling
parent e007c24ec9
commit bee42160c5
Notes: sideshowbarker 2024-07-17 05:13:53 +09:00
3 changed files with 21 additions and 1 deletions

View file

@ -0,0 +1,10 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x0 children: inline
BlockContainer <div> at (8,550) content-size 100x50 positioned [BFC] children: not-inline
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x0]
PaintableWithLines (BlockContainer<DIV>) [8,550 100x50]

View file

@ -0,0 +1,10 @@
<style>
div {
position: absolute;
background: red;
width: 100px;
height: 100px;
max-height: 50px;
bottom: 0px;
}
</style><div></div>

View file

@ -974,7 +974,7 @@ void FormattingContext::compute_height_for_absolutely_positioned_non_replaced_el
- margin_top.to_px(box, width_of_containing_block)
- box.computed_values().border_top().width
- box.computed_values().padding().top().to_px(box, width_of_containing_block)
- height.to_px(box)
- apply_min_max_height_constraints(height).to_px(box)
- box.computed_values().padding().bottom().to_px(box, width_of_containing_block)
- box.computed_values().border_bottom().width
- margin_bottom.to_px(box, width_of_containing_block)