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

LibWeb: Derive baseline from rightmost descendant

Make the existing algorithm recursive, accounting for boxes which
contain line boxes indirectly. Fixes some button alignment issues on
Wikipedia.
This commit is contained in:
Andi Gallo 2023-08-20 08:50:28 +00:00 committed by Andreas Kling
parent 2a8f558911
commit bab1d09d92
14 changed files with 188 additions and 36 deletions

View file

@ -0,0 +1,44 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x47.671875 children: inline
line 0 width: 61.1875, height: 47.671875, bottom: 47.671875, baseline: 35.828125
frag 0 from BlockContainer start: 0, length: 0, rect: [8,8 61.1875x47.671875]
BlockContainer <div.ib> at (8,8) content-size 61.1875x47.671875 inline-block [BFC] children: inline
line 0 width: 61.1875, height: 47.671875, bottom: 47.671875, baseline: 35.828125
frag 0 from BlockContainer start: 0, length: 0, rect: [9,26 17.828125x21.84375]
frag 1 from TextNode start: 0, length: 1, rect: [28,30 8x17.46875]
" "
frag 2 from BlockContainer start: 0, length: 0, rect: [41,10 23.359375x43.671875]
TextNode <#text>
BlockContainer <div.label> at (9,26) content-size 17.828125x21.84375 inline-block [BFC] children: inline
line 0 width: 17.828125, height: 21.84375, bottom: 21.84375, baseline: 16.921875
frag 0 from TextNode start: 0, length: 1, rect: [9,26 17.828125x21.84375]
"A"
TextNode <#text>
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>
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x47.671875]
PaintableWithLines (BlockContainer<DIV>.ib) [8,8 61.1875x47.671875]
PaintableWithLines (BlockContainer<DIV>.label) [8,25 19.828125x23.84375]
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]
PaintableBox (Box(anonymous)) [41,10 23.359375x43.671875]
PaintableWithLines (BlockContainer(anonymous)) [41,10 23.359375x43.671875]
TextPaintable (TextNode<#text>)

View file

@ -1,7 +1,7 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x200 children: inline
line 0 width: 76.6875, height: 200, bottom: 200, baseline: 200
line 0 width: 76.6875, height: 200, bottom: 200, baseline: 71
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

View file

@ -0,0 +1,50 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x47.671875 children: inline
line 0 width: 61.1875, height: 47.671875, bottom: 47.671875, baseline: 33.828125
frag 0 from BlockContainer start: 0, length: 0, rect: [8,8 61.1875x47.671875]
BlockContainer <div.ib> at (8,8) content-size 61.1875x47.671875 inline-block [BFC] children: inline
line 0 width: 61.1875, height: 47.671875, bottom: 47.671875, baseline: 33.828125
frag 0 from BlockContainer start: 0, length: 0, rect: [9,24 17.828125x21.84375]
frag 1 from TextNode start: 0, length: 1, rect: [28,28 8x17.46875]
" "
frag 2 from BlockContainer start: 0, length: 0, rect: [41,10 23.359375x43.671875]
TextNode <#text>
BlockContainer <div.label> at (9,24) content-size 17.828125x21.84375 inline-block [BFC] children: inline
line 0 width: 17.828125, height: 21.84375, bottom: 21.84375, baseline: 16.921875
frag 0 from TextNode start: 0, length: 1, rect: [9,24 17.828125x21.84375]
"A"
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>
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x47.671875]
PaintableWithLines (BlockContainer<DIV>.ib) [8,8 61.1875x47.671875]
PaintableWithLines (BlockContainer<DIV>.label) [8,23 19.828125x23.84375]
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]
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]

View file

@ -1,10 +1,10 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x21.46875 children: inline
line 0 width: 59.921875, height: 21.46875, bottom: 21.46875, baseline: 19.46875
line 0 width: 59.921875, height: 21.46875, bottom: 21.46875, baseline: 15.53125
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: 17.46875
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

View file

@ -1,10 +1,10 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x56.40625 children: inline
line 0 width: 121.65625, height: 56.40625, bottom: 56.40625, baseline: 54.40625
line 0 width: 121.65625, height: 56.40625, bottom: 56.40625, baseline: 42.59375
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: 52.40625
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

View file

@ -1,10 +1,10 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x21.46875 children: inline
line 0 width: 47.21875, height: 21.46875, bottom: 21.46875, baseline: 19.46875
line 0 width: 47.21875, height: 21.46875, bottom: 21.46875, baseline: 15.53125
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: 17.46875
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