mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 20:33:10 +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:
parent
3216cc34a6
commit
ed0dc2ff72
|
@ -18,15 +18,13 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
TextNode <#text>
|
||||
BlockContainer <button> at (41,10) content-size 23.359375x43.671875 inline-block [BFC] children: inline
|
||||
line 0 width: 23.359375, height: 43.671875, bottom: 43.671875, baseline: 33.828125
|
||||
frag 0 from TableWrapper start: 0, length: 0, rect: [41,10 23.359375x43.671875]
|
||||
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: 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>
|
||||
frag 0 from BlockContainer start: 0, length: 0, rect: [41,10 23.359375x43.671875]
|
||||
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: 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>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
|
@ -37,8 +35,6 @@ 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]
|
||||
TextPaintable (TextNode<#text>)
|
||||
TextPaintable (TextNode<#text>)
|
||||
|
|
|
@ -5,24 +5,20 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 420x415.203125]
|
||||
BlockContainer <button> at (13,10) content-size 420x415.203125 inline-block [BFC] children: inline
|
||||
line 0 width: 420, height: 415.203125, bottom: 415.203125, baseline: 420
|
||||
frag 0 from TableWrapper start: 0, length: 0, rect: [13,10 420x420]
|
||||
TableWrapper <(anonymous)> at (13,10) content-size 420x420 [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 420x420 table-box [TFC] children: not-inline
|
||||
Box <(anonymous)> at (13,10) content-size 420x420 table-row children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 420x420 table-cell [BFC] children: inline
|
||||
line 0 width: 420, height: 420, bottom: 420, baseline: 420
|
||||
frag 0 from ImageBox start: 0, length: 0, rect: [13,10 420x420]
|
||||
TextNode <#text>
|
||||
ImageBox <img> at (13,10) content-size 420x420 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 420x420]
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 420x420 flex-container(column) [FFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 420x420 flex-item [BFC] children: inline
|
||||
line 0 width: 420, height: 420, bottom: 420, baseline: 420
|
||||
frag 0 from ImageBox start: 0, length: 0, rect: [13,10 420x420]
|
||||
TextNode <#text>
|
||||
ImageBox <img> at (13,10) content-size 420x420 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x419.203125]
|
||||
PaintableWithLines (BlockContainer<BUTTON>) [8,8 430x419.203125] overflow: [9,9 428x421]
|
||||
PaintableWithLines (TableWrapper(anonymous)) [13,10 420x420]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 420x420]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 420x420]
|
||||
PaintableBox (Box(anonymous)) [13,10 420x420]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 420x420]
|
||||
ImagePaintable (ImageBox<IMG>) [13,10 420x420]
|
||||
ImagePaintable (ImageBox<IMG>) [13,10 420x420]
|
||||
|
|
|
@ -5,39 +5,35 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
frag 0 from BlockContainer start: 0, length: 0, rect: [22,19 48.6875x178]
|
||||
TextNode <#text>
|
||||
BlockContainer <button.button.border-black> at (22,19) content-size 48.6875x178 inline-block [BFC] children: not-inline
|
||||
TableWrapper <(anonymous)> at (22,19) content-size 48.6875x178 [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (22,19) content-size 48.6875x178 table-box [TFC] children: not-inline
|
||||
Box <(anonymous)> at (22,19) content-size 48.6875x178 table-row children: not-inline
|
||||
BlockContainer <(anonymous)> at (22,29.265625) content-size 48.6875x157.46875 table-cell [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (22,29.265625) content-size 48.6875x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <div.border-black> at (32,39.265625) content-size 28.6875x17.46875 children: inline
|
||||
line 0 width: 28.6875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 1, length: 3, rect: [32,39.265625 28.6875x17.46875]
|
||||
"one"
|
||||
TextNode <#text>
|
||||
BlockContainer <(anonymous)> at (22,66.734375) content-size 48.6875x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <div.border-black> at (32,76.734375) content-size 28.6875x100 children: inline
|
||||
line 0 width: 28.4375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 1, length: 3, rect: [32,76.734375 28.4375x17.46875]
|
||||
"two"
|
||||
TextNode <#text>
|
||||
BlockContainer <(anonymous)> at (22,186.734375) content-size 48.6875x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <(anonymous)> at (22,19) content-size 48.6875x178 flex-container(column) [FFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (22,29.265625) content-size 48.6875x157.46875 flex-item [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (22,29.265625) content-size 48.6875x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <div.border-black> at (32,39.265625) content-size 28.6875x17.46875 children: inline
|
||||
line 0 width: 28.6875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 1, length: 3, rect: [32,39.265625 28.6875x17.46875]
|
||||
"one"
|
||||
TextNode <#text>
|
||||
BlockContainer <(anonymous)> at (22,66.734375) content-size 48.6875x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <div.border-black> at (32,76.734375) content-size 28.6875x100 children: inline
|
||||
line 0 width: 28.4375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 1, length: 3, rect: [32,76.734375 28.4375x17.46875]
|
||||
"two"
|
||||
TextNode <#text>
|
||||
BlockContainer <(anonymous)> at (22,186.734375) content-size 48.6875x0 children: inline
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x200]
|
||||
PaintableWithLines (BlockContainer<BUTTON>.button.border-black) [8,8 76.6875x200]
|
||||
PaintableWithLines (TableWrapper(anonymous)) [22,19 48.6875x178]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,19 48.6875x178]
|
||||
PaintableBox (Box(anonymous)) [22,19 48.6875x178]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,19 48.6875x178]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,29.265625 48.6875x0]
|
||||
PaintableWithLines (BlockContainer<DIV>.border-black) [22,29.265625 48.6875x37.46875]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,66.734375 48.6875x0]
|
||||
PaintableWithLines (BlockContainer<DIV>.border-black) [22,66.734375 48.6875x120]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,186.734375 48.6875x0]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,19 48.6875x178]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,29.265625 48.6875x157.46875]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,29.265625 48.6875x0]
|
||||
PaintableWithLines (BlockContainer<DIV>.border-black) [22,29.265625 48.6875x37.46875]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,66.734375 48.6875x0]
|
||||
PaintableWithLines (BlockContainer<DIV>.border-black) [22,66.734375 48.6875x120]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer(anonymous)) [22,186.734375 48.6875x0]
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x58 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x42 children: inline
|
||||
line 0 width: 42, height: 42, bottom: 42, baseline: 42
|
||||
frag 0 from BlockContainer start: 0, length: 0, rect: [29,29 0x0]
|
||||
BlockContainer <button> at (29,29) content-size 0x0 positioned inline-block [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (29,29) content-size 0x0 flex-container(column) [FFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (29,29) content-size 0x0 flex-item [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (9,9) content-size 40x40 positioned [BFC] children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x58]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x42]
|
||||
PaintableWithLines (BlockContainer<BUTTON>) [8,8 42x42]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [29,29 0x0] overflow: [9,9 40x40]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [29,29 0x0] overflow: [9,9 40x40]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [9,9 40x40]
|
|
@ -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]
|
||||
|
|
|
@ -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 49.921875x17.46875]
|
||||
BlockContainer <button> at (13,10) content-size 49.921875x17.46875 inline-block [BFC] children: inline
|
||||
line 0 width: 49.921875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TableWrapper start: 0, length: 0, rect: [13,10 49.921875x17.46875]
|
||||
TableWrapper <(anonymous)> at (13,10) content-size 49.921875x17.46875 [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 49.921875x17.46875 table-box [TFC] children: not-inline
|
||||
Box <(anonymous)> at (13,10) content-size 49.921875x17.46875 table-row children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 49.921875x17.46875 table-cell [BFC] children: inline
|
||||
line 0 width: 49.921875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 0, length: 5, rect: [13,10 49.921875x17.46875]
|
||||
"A B C"
|
||||
TextNode <#text>
|
||||
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 49.921875x17.46875]
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 49.921875x17.46875 flex-container(column) [FFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 49.921875x17.46875 flex-item [BFC] children: inline
|
||||
line 0 width: 49.921875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 0, length: 5, rect: [13,10 49.921875x17.46875]
|
||||
"A B C"
|
||||
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 59.921875x21.46875]
|
||||
PaintableWithLines (TableWrapper(anonymous)) [13,10 49.921875x17.46875]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 49.921875x17.46875]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 49.921875x17.46875]
|
||||
PaintableBox (Box(anonymous)) [13,10 49.921875x17.46875]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 49.921875x17.46875]
|
||||
TextPaintable (TextNode<#text>)
|
||||
TextPaintable (TextNode<#text>)
|
||||
|
|
|
@ -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 111.65625x52.40625]
|
||||
BlockContainer <button> at (13,10) content-size 111.65625x52.40625 inline-block [BFC] children: inline
|
||||
line 0 width: 111.65625, height: 52.40625, bottom: 52.40625, baseline: 40.59375
|
||||
frag 0 from TableWrapper start: 0, length: 0, rect: [13,10 111.65625x52.40625]
|
||||
TableWrapper <(anonymous)> at (13,10) content-size 111.65625x52.40625 [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 111.65625x52.40625 table-box [TFC] children: not-inline
|
||||
Box <(anonymous)> at (13,10) content-size 111.65625x52.40625 table-row children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 111.65625x52.40625 table-cell [BFC] children: inline
|
||||
line 0 width: 111.65625, height: 52.40625, bottom: 52.40625, baseline: 40.59375
|
||||
frag 0 from TextNode start: 0, length: 4, rect: [13,10 111.65625x52.40625]
|
||||
"Test"
|
||||
TextNode <#text>
|
||||
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 111.65625x52.40625]
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 111.65625x52.40625 flex-container(column) [FFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,10) content-size 111.65625x52.40625 flex-item [BFC] children: inline
|
||||
line 0 width: 111.65625, height: 52.40625, bottom: 52.40625, baseline: 40.59375
|
||||
frag 0 from TextNode start: 0, length: 4, rect: [13,10 111.65625x52.40625]
|
||||
"Test"
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x56.40625]
|
||||
PaintableWithLines (BlockContainer<BUTTON>) [8,8 121.65625x56.40625]
|
||||
PaintableWithLines (TableWrapper(anonymous)) [13,10 111.65625x52.40625]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 111.65625x52.40625]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 111.65625x52.40625]
|
||||
PaintableBox (Box(anonymous)) [13,10 111.65625x52.40625]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,10 111.65625x52.40625]
|
||||
TextPaintable (TextNode<#text>)
|
||||
TextPaintable (TextNode<#text>)
|
||||
|
|
|
@ -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>)
|
||||
|
|
|
@ -4,16 +4,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
line 0 width: 10, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from BlockContainer start: 0, length: 0, rect: [13,19 0x0]
|
||||
BlockContainer <button> at (13,19) content-size 0x0 inline-block [BFC] children: not-inline
|
||||
TableWrapper <(anonymous)> at (13,19) content-size 0x0 [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,19) content-size 0x0 table-box [TFC] children: not-inline
|
||||
Box <(anonymous)> at (13,19) content-size 0x0 table-row children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,19) content-size 0x0 table-cell [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,19) content-size 0x0 flex-container(column) [FFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (13,19) content-size 0x0 [BFC] children: not-inline
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x17.46875]
|
||||
PaintableWithLines (BlockContainer<BUTTON>) [8,17 10x4]
|
||||
PaintableWithLines (TableWrapper(anonymous)) [13,19 0x0]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,19 0x0]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,19 0x0]
|
||||
PaintableBox (Box(anonymous)) [13,19 0x0]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [13,19 0x0]
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html><style>
|
||||
button {
|
||||
position: relative;
|
||||
padding: 20px;
|
||||
background: initial;
|
||||
}
|
||||
button:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background: green;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style><body><button></button>
|
|
@ -383,25 +383,20 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
|
|||
auto& parent = *dom_node.layout_node();
|
||||
|
||||
// If the box does not overflow in the vertical axis, then it is centered vertically.
|
||||
auto table_computed_values = parent.computed_values().clone_inherited_values();
|
||||
static_cast<CSS::MutableComputedValues&>(table_computed_values).set_display(CSS::Display::from_short(CSS::Display::Short::Table));
|
||||
static_cast<CSS::MutableComputedValues&>(table_computed_values).set_height(CSS::Size::make_percentage(CSS::Percentage(100)));
|
||||
// FIXME: Only apply alignment when box overflows
|
||||
auto flex_computed_values = parent.computed_values().clone_inherited_values();
|
||||
auto& mutable_flex_computed_values = static_cast<CSS::MutableComputedValues&>(flex_computed_values);
|
||||
mutable_flex_computed_values.set_display(CSS::Display { CSS::Display::Outside::Block, CSS::Display::Inside::Flex });
|
||||
mutable_flex_computed_values.set_justify_content(CSS::JustifyContent::Center);
|
||||
mutable_flex_computed_values.set_flex_direction(CSS::FlexDirection::Column);
|
||||
mutable_flex_computed_values.set_height(CSS::Size::make_percentage(CSS::Percentage(100)));
|
||||
auto flex_wrapper = parent.heap().template allocate_without_realm<BlockContainer>(parent.document(), nullptr, move(flex_computed_values));
|
||||
|
||||
auto cell_computed_values = parent.computed_values().clone_inherited_values();
|
||||
static_cast<CSS::MutableComputedValues&>(cell_computed_values).set_display(CSS::Display { CSS::Display::Internal::TableCell });
|
||||
static_cast<CSS::MutableComputedValues&>(cell_computed_values).set_vertical_align(CSS::VerticalAlign::Middle);
|
||||
|
||||
auto row_computed_values = parent.computed_values().clone_inherited_values();
|
||||
static_cast<CSS::MutableComputedValues&>(row_computed_values).set_display(CSS::Display { CSS::Display::Internal::TableRow });
|
||||
|
||||
auto table_wrapper = parent.heap().template allocate_without_realm<BlockContainer>(parent.document(), nullptr, move(table_computed_values));
|
||||
auto cell_wrapper = parent.heap().template allocate_without_realm<BlockContainer>(parent.document(), nullptr, move(cell_computed_values));
|
||||
auto row_wrapper = parent.heap().template allocate_without_realm<Box>(parent.document(), nullptr, move(row_computed_values));
|
||||
|
||||
cell_wrapper->set_line_height(parent.line_height());
|
||||
cell_wrapper->set_font(parent.font());
|
||||
cell_wrapper->set_children_are_inline(parent.children_are_inline());
|
||||
row_wrapper->set_children_are_inline(false);
|
||||
auto content_box_computed_values = parent.computed_values().clone_inherited_values();
|
||||
auto content_box_wrapper = parent.heap().template allocate_without_realm<BlockContainer>(parent.document(), nullptr, move(content_box_computed_values));
|
||||
content_box_wrapper->set_font(parent.font());
|
||||
content_box_wrapper->set_line_height(parent.line_height());
|
||||
content_box_wrapper->set_children_are_inline(parent.children_are_inline());
|
||||
|
||||
Vector<JS::Handle<Node>> sequence;
|
||||
for (auto child = parent.first_child(); child; child = child->next_sibling()) {
|
||||
|
@ -410,12 +405,12 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
|
|||
|
||||
for (auto& node : sequence) {
|
||||
parent.remove_child(*node);
|
||||
cell_wrapper->append_child(*node);
|
||||
content_box_wrapper->append_child(*node);
|
||||
}
|
||||
|
||||
row_wrapper->append_child(*cell_wrapper);
|
||||
table_wrapper->append_child(*row_wrapper);
|
||||
parent.append_child(*table_wrapper);
|
||||
flex_wrapper->append_child(*content_box_wrapper);
|
||||
|
||||
parent.append_child(*flex_wrapper);
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
Loading…
Reference in a new issue