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

LibWeb: Use flex layout for button content alignment

Using flex layout inside button solves the issue with wrongly calculated
height when it has: pseudo element and whitespaces inside.

Also using flex instead of a table layout allows for the same vertical
alignment but with fewer layout nodes: a flex container and anonymous
wrapper for content instead of a table wrapper, table, row, and cell.
This commit is contained in:
Aliaksandr Kalenik 2023-09-03 11:07:38 +02:00 committed by Andreas Kling
parent 3216cc34a6
commit ed0dc2ff72
11 changed files with 145 additions and 147 deletions

View file

@ -17,19 +17,17 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
TextNode <#text>
TextNode <#text>
BlockContainer <button> at (41,10) content-size 23.359375x43.671875 inline-block [BFC] children: not-inline
TableWrapper <(anonymous)> at (41,10) content-size 23.359375x43.671875 [BFC] children: not-inline
BlockContainer <(anonymous)> at (41,10) content-size 23.359375x43.671875 table-box [TFC] children: not-inline
Box <(anonymous)> at (41,10) content-size 23.359375x43.671875 table-row children: not-inline
BlockContainer <(anonymous)> at (41,10) content-size 23.359375x43.671875 table-cell [BFC] children: not-inline
BlockContainer <(anonymous)> at (41,10) content-size 23.359375x0 children: inline
TextNode <#text>
BlockContainer <div> at (41,10) content-size 23.359375x43.671875 children: inline
line 0 width: 23.359375, height: 43.671875, bottom: 43.671875, baseline: 33.828125
frag 0 from TextNode start: 0, length: 1, rect: [41,10 23.359375x43.671875]
"B"
TextNode <#text>
BlockContainer <(anonymous)> at (41,53.671875) content-size 23.359375x0 children: inline
TextNode <#text>
BlockContainer <(anonymous)> at (41,10) content-size 23.359375x43.671875 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (41,10) content-size 23.359375x43.671875 flex-item [BFC] children: not-inline
BlockContainer <(anonymous)> at (41,10) content-size 23.359375x0 children: inline
TextNode <#text>
BlockContainer <div> at (41,10) content-size 23.359375x43.671875 children: inline
line 0 width: 23.359375, height: 43.671875, bottom: 43.671875, baseline: 33.828125
frag 0 from TextNode start: 0, length: 1, rect: [41,10 23.359375x43.671875]
"B"
TextNode <#text>
BlockContainer <(anonymous)> at (41,53.671875) content-size 23.359375x0 children: inline
TextNode <#text>
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
@ -40,11 +38,9 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
TextPaintable (TextNode<#text>)
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<BUTTON>) [36,8 33.359375x47.671875]
PaintableWithLines (TableWrapper(anonymous)) [41,10 23.359375x43.671875]
PaintableWithLines (BlockContainer(anonymous)) [41,10 23.359375x43.671875]
PaintableWithLines (BlockContainer(anonymous)) [41,10 23.359375x43.671875]
PaintableBox (Box(anonymous)) [41,10 23.359375x43.671875]
PaintableWithLines (BlockContainer(anonymous)) [41,10 23.359375x43.671875]
PaintableWithLines (BlockContainer(anonymous)) [41,10 23.359375x0]
PaintableWithLines (BlockContainer<DIV>) [41,10 23.359375x43.671875]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [41,53.671875 23.359375x0]
PaintableWithLines (BlockContainer(anonymous)) [41,10 23.359375x0]
PaintableWithLines (BlockContainer<DIV>) [41,10 23.359375x43.671875]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [41,53.671875 23.359375x0]