LibWeb: Account for intrinsic width or height in flex base size

In calculating the base size of a flex item, we have a piece of ad-hoc
code that deals with an item that does have an instrinsic aspect ratio,
but not a cross size to resolve that ratio against. In determining the
actual flex item size however, we also take into account the minimum
content width and height, which assumes the box' intrinsic width or
height when available. This would break having an image as a flex item,
which gets stretched to its maximum size within the flex container
instead of the flex item being shrunk to the instrinsic size of the
image.

Fix this by only stretching flex items that do not have an instrinsic
width nor height set.
This commit is contained in:
Jelle Raaijmakers 2024-08-08 17:04:59 +02:00 committed by Sam Atkins
commit 7a783d3a89
Notes: github-actions[bot] 2024-08-09 16:02:41 +00:00
3 changed files with 23 additions and 6 deletions

View file

@ -0,0 +1,15 @@
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 784x8 children: not-inline
Box <div> at (8,8) content-size 784x8 flex-container(row) [FFC] children: not-inline
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
TextNode <#text>
ImageBox <img> at (8,8) content-size 8x8 flex-item children: not-inline
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x8]
PaintableBox (Box<DIV>) [8,8 784x8]
ImagePaintable (ImageBox<IMG>) [8,8 8x8]