mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:27:43 +00:00
LibWeb: Fix abspos flex container with height:auto getting zero height
When laying out abspos boxes, we compute the height twice: before and after the inside of the box has been laid out. The first pass allows percentage vertical values inside the box to be resolved against the box's height. The second pass resolves the final used value for the height of the box itself. In cases where the box height depends on the results of inside layout, we were incorrectly setting the box to having a definite zero height. This led to incorrect results when sizing an abspos flex container, since the FFC sizes containers (in row layouts) based on whether the container has a definite height. To avoid this problem, this patch adds an enum so we can differentiate between the two abspos height computation passes. If the first pass discovers a dependency on the inside layout, we simply bail out of computing the height, leaving it as indefinite. This allows the FFC to size its container correctly, and the correct height gets set by the second pass.
This commit is contained in:
parent
6d54e5ce9a
commit
80ce0419b6
3 changed files with 44 additions and 10 deletions
12
Base/res/html/tests/abspos-flexbox-with-auto-height.html
Normal file
12
Base/res/html/tests/abspos-flexbox-with-auto-height.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html><html><head><style>
|
||||
* {
|
||||
border: 1px solid black;
|
||||
}
|
||||
nav {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
}
|
||||
.item {
|
||||
background: lime;
|
||||
}
|
||||
</style></head><body><nav><div class=item>This should have a green background.</div></nav></body></html>
|
Loading…
Add table
Add a link
Reference in a new issue