1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:27:35 +00:00

LibWeb: Stop changing width of block-level flex containers during layout

If the parent BFC can come up with a nice stretch-fit width for the flex
container, it will have already done so *before* even entering flex
layout. There's no need to do it again, midway through the flex layout
algorithm.

This wasn't just unnecessary, but we were also doing it incorrectly and
not taking margins into account when calculating the amount of available
space for stretch-fit. This led to oversized flex containers in the
presence of negative margins.

Fixes #18614
This commit is contained in:
Andreas Kling 2023-05-08 14:48:03 +02:00
parent 771208d2e2
commit 1ebae7a779
5 changed files with 24 additions and 4 deletions

View file

@ -1,6 +1,6 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (1,1) content-size 798x39.46875 [BFC] children: not-inline
Box <body.outer> at (10,10) content-size 764x21.46875 flex-container(row) [FFC] children: not-inline
Box <body.outer> at (10,10) content-size 780x21.46875 flex-container(row) [FFC] children: not-inline
BlockContainer <div.middle> at (11,11) content-size 202x19.46875 flex-item [BFC] children: not-inline
BlockContainer <div.inner> at (12,12) content-size 200x17.46875 children: inline
line 0 width: 45.15625, height: 17.46875, bottom: 17.46875, baseline: 13.53125