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

LibWeb: Narrow width of boxes that create BFC to avoid overlap of float

https://www.w3.org/TR/CSS22/visuren.html#floats says that when a box
establishes BFC it should not overlap with floats. The way to avoid
overlaps is up to implementor. This change implements avoiding overlap
by narrowing width of a box because it seems like what other engines
do (in the scenarios I tested).
This commit is contained in:
Aliaksandr Kalenik 2023-05-04 06:34:35 +03:00 committed by Andreas Kling
parent bf41af6b9d
commit 853ecb8d8e
3 changed files with 71 additions and 10 deletions

View file

@ -0,0 +1,22 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x1008 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x108.21875 children: not-inline
BlockContainer <div.wrapper> at (8,8) content-size 784x108.21875 children: not-inline
BlockContainer <div.float> at (592,8) content-size 200x1000 floating [BFC] children: not-inline
BlockContainer <div.bfc> at (18,18) content-size 564x88.21875 [BFC] children: inline
line 0 width: 458.125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 56, rect: [18,18 458.125x17.46875]
"Lorem ipsum dolor sit amet, consectetur adipiscing elit."
line 1 width: 511.796875, height: 17.9375, bottom: 35.40625, baseline: 13.53125
frag 0 from TextNode start: 57, length: 60, rect: [18,35 511.796875x17.46875]
"Pellentesque vitae neque nunc. Nam fermentum libero a lectus"
line 2 width: 537.078125, height: 18.40625, bottom: 53.34375, baseline: 13.53125
frag 0 from TextNode start: 118, length: 67, rect: [18,52 537.078125x17.46875]
"vulputate eleifend. Nam sagittis tristique augue, id sodales mauris"
line 3 width: 537.34375, height: 17.875, bottom: 70.28125, baseline: 13.53125
frag 0 from TextNode start: 186, length: 65, rect: [18,70 537.34375x17.46875]
"suscipit at. Vivamus eget placerat ex. Suspendisse potenti. Morbi"
line 4 width: 455.375, height: 18.34375, bottom: 88.21875, baseline: 13.53125
frag 0 from TextNode start: 252, length: 57, rect: [18,87 455.375x17.46875]
"pulvinar ipsum eget nulla dapibus, ac varius mi eleifend."
TextNode <#text>