1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:57:44 +00:00

LibWeb: Account for box-sizing in grid-items width calculation

Visual improvement on (now there is a gap between grid items):
https://twinings.co.uk/collections/earl-grey-tea
This commit is contained in:
Aliaksandr Kalenik 2023-11-02 05:16:51 +01:00 committed by Andreas Kling
parent e02a4f5181
commit 2fb0cede9a
3 changed files with 49 additions and 3 deletions

View file

@ -0,0 +1,27 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (1,1) content-size 798x41.46875 [BFC] children: not-inline
BlockContainer <body> at (10,10) content-size 780x23.46875 children: not-inline
Box <div.grid> at (11,11) content-size 778x21.46875 [GFC] children: not-inline
BlockContainer <div.item> at (112,12) content-size 187x19.46875 [BFC] children: not-inline
BlockContainer <div> at (113,13) content-size 185x17.46875 children: inline
line 0 width: 29.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 3, rect: [113,13 29.8125x17.46875]
"One"
TextNode <#text>
BlockContainer <div.item> at (501,12) content-size 187x19.46875 [BFC] children: not-inline
BlockContainer <div> at (502,13) content-size 185x17.46875 children: inline
line 0 width: 33.875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 3, rect: [502,13 33.875x17.46875]
"Two"
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x43.46875]
PaintableWithLines (BlockContainer<BODY>) [9,9 782x25.46875]
PaintableBox (Box<DIV>.grid) [10,10 780x23.46875]
PaintableWithLines (BlockContainer<DIV>.item) [11,11 389x21.46875]
PaintableWithLines (BlockContainer<DIV>) [112,12 187x19.46875]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<DIV>.item) [400,11 389x21.46875]
PaintableWithLines (BlockContainer<DIV>) [501,12 187x19.46875]
TextPaintable (TextNode<#text>)

View file

@ -0,0 +1,16 @@
<!DOCTYPE html><style type="text/css">
* {
border: 1px solid black;
}
.grid {
grid-template-columns: 1fr 1fr;
display: grid;
}
.item {
padding: 0 100px;
width: 100%;
box-sizing: border-box;
}
</style><div class="grid"><div class="item"><div>One</div></div><div class="item"><div>Two</div></div></div>