1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +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

@ -5,22 +5,18 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 37.21875x17.46875]
BlockContainer <button> at (13,10) content-size 37.21875x17.46875 inline-block [BFC] children: inline
line 0 width: 37.21875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TableWrapper start: 0, length: 0, rect: [13,10 37.21875x17.46875]
TableWrapper <(anonymous)> at (13,10) content-size 37.21875x17.46875 [BFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 37.21875x17.46875 table-box [TFC] children: not-inline
Box <(anonymous)> at (13,10) content-size 37.21875x17.46875 table-row children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 37.21875x17.46875 table-cell [BFC] children: inline
line 0 width: 37.21875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 4, rect: [13,10 37.21875x17.46875]
"Test"
TextNode <#text>
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 37.21875x17.46875]
BlockContainer <(anonymous)> at (13,10) content-size 37.21875x17.46875 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 37.21875x17.46875 flex-item [BFC] children: inline
line 0 width: 37.21875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 4, rect: [13,10 37.21875x17.46875]
"Test"
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x21.46875]
PaintableWithLines (BlockContainer<BUTTON>) [8,8 47.21875x21.46875]
PaintableWithLines (TableWrapper(anonymous)) [13,10 37.21875x17.46875]
PaintableWithLines (BlockContainer(anonymous)) [13,10 37.21875x17.46875]
PaintableWithLines (BlockContainer(anonymous)) [13,10 37.21875x17.46875]
PaintableBox (Box(anonymous)) [13,10 37.21875x17.46875]
PaintableWithLines (BlockContainer(anonymous)) [13,10 37.21875x17.46875]
TextPaintable (TextNode<#text>)
TextPaintable (TextNode<#text>)