1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:47:34 +00:00

LibWeb: Bring CSS line-height closer to other engines

This patch makes a few changes to the way we calculate line-height:

- `line-height: normal` is now resolved using metrics from the used
  font (specifically, round(A + D + lineGap)).

- `line-height: calc(...)` is now resolved at style compute time.

- `line-height` values are now absolutized at style compute time.

As a consequence of the above, we no longer need to walk the DOM
ancestor chain looking for line-heights during style computation.
Instead, values are inherited, resolved and absolutized locally.

This is not only much faster, but also makes our line-height metrics
match those of other engines like Gecko and Blink.
This commit is contained in:
Andreas Kling 2024-01-12 12:39:40 +01:00
parent f0722671c3
commit e7de5cb4d2
385 changed files with 6889 additions and 6893 deletions

View file

@ -1,147 +1,147 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x103.875 [BFC] children: not-inline
BlockContainer <html> at (0,0) content-size 800x102 [BFC] children: not-inline
BlockContainer <(anonymous)> at (0,0) content-size 800x0 children: inline
TextNode <#text>
BlockContainer <body> at (8,8) content-size 784x87.875 children: not-inline
BlockContainer <body> at (8,8) content-size 784x86 children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline
TextNode <#text>
TableWrapper <(anonymous)> at (8,8) content-size 229.359375x87.875 [BFC] children: not-inline
Box <table> at (8,8) content-size 229.359375x87.875 table-box [TFC] children: not-inline
TableWrapper <(anonymous)> at (8,8) content-size 229.359375x86 [BFC] children: not-inline
Box <table> at (8,8) content-size 229.359375x86 table-box [TFC] children: not-inline
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
Box <tbody> at (8,8) content-size 221.359375x77.875 table-row-group children: not-inline
Box <tr> at (10,10) content-size 221.359375x19.46875 table-row children: not-inline
Box <tbody> at (8,8) content-size 221.359375x76 table-row-group children: not-inline
Box <tr> at (10,10) content-size 221.359375x19 table-row children: not-inline
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <th> at (11,11) content-size 70.046875x17.46875 table-cell [BFC] children: inline
line 0 width: 70.046875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 8, rect: [11,11 70.046875x17.46875]
BlockContainer <th> at (11,11) content-size 70.046875x17 table-cell [BFC] children: inline
line 0 width: 70.046875, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 8, rect: [11,11 70.046875x17]
"Header 1"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <th> at (85.046875,11) content-size 72.515625x17.46875 table-cell [BFC] children: inline
line 0 width: 72.515625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 8, rect: [85.046875,11 72.515625x17.46875]
BlockContainer <th> at (85.046875,11) content-size 72.515625x17 table-cell [BFC] children: inline
line 0 width: 72.515625, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 8, rect: [85.046875,11 72.515625x17]
"Header 2"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <th> at (161.5625,11) content-size 72.796875x17.46875 table-cell [BFC] children: inline
line 0 width: 72.796875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 8, rect: [161.5625,11 72.796875x17.46875]
BlockContainer <th> at (161.5625,11) content-size 72.796875x17 table-cell [BFC] children: inline
line 0 width: 72.796875, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 8, rect: [161.5625,11 72.796875x17]
"Header 3"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
Box <tr> at (10,31.46875) content-size 221.359375x19.46875 table-row children: not-inline
Box <tr> at (10,31) content-size 221.359375x19 table-row children: not-inline
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <td> at (11,43.203125) content-size 70.046875x17.46875 table-cell [BFC] children: inline
line 0 width: 49.609375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 5, rect: [11,43.203125 49.609375x17.46875]
BlockContainer <td> at (11,42.5) content-size 70.046875x17 table-cell [BFC] children: inline
line 0 width: 49.609375, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 5, rect: [11,42.5 49.609375x17]
"Row 1"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <td> at (85.046875,32.46875) content-size 72.515625x17.46875 table-cell [BFC] children: inline
line 0 width: 41.84375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 6, rect: [85.046875,32.46875 41.84375x17.46875]
BlockContainer <td> at (85.046875,32) content-size 72.515625x17 table-cell [BFC] children: inline
line 0 width: 41.84375, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 6, rect: [85.046875,32 41.84375x17]
"Cell 1"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <td> at (161.5625,32.46875) content-size 72.796875x17.46875 table-cell [BFC] children: inline
line 0 width: 44.3125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 6, rect: [161.5625,32.46875 44.3125x17.46875]
BlockContainer <td> at (161.5625,32) content-size 72.796875x17 table-cell [BFC] children: inline
line 0 width: 44.3125, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 6, rect: [161.5625,32 44.3125x17]
"Cell 2"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
Box <tr> at (10,52.9375) content-size 221.359375x19.46875 table-row children: not-inline
Box <tr> at (10,52) content-size 221.359375x19 table-row children: not-inline
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <td> at (85.046875,53.9375) content-size 72.515625x17.46875 table-cell [BFC] children: inline
line 0 width: 44.59375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 6, rect: [85.046875,53.9375 44.59375x17.46875]
BlockContainer <td> at (85.046875,53) content-size 72.515625x17 table-cell [BFC] children: inline
line 0 width: 44.59375, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 6, rect: [85.046875,53 44.59375x17]
"Cell 3"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <td> at (161.5625,53.9375) content-size 72.796875x17.46875 table-cell [BFC] children: inline
line 0 width: 43.25, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 6, rect: [161.5625,53.9375 43.25x17.46875]
BlockContainer <td> at (161.5625,53) content-size 72.796875x17 table-cell [BFC] children: inline
line 0 width: 43.25, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 6, rect: [161.5625,53 43.25x17]
"Cell 4"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
Box <tr> at (10,74.40625) content-size 221.359375x19.46875 table-row children: not-inline
Box <tr> at (10,73) content-size 221.359375x19 table-row children: not-inline
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <td> at (11,75.40625) content-size 70.046875x17.46875 table-cell [BFC] children: inline
line 0 width: 52.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 5, rect: [11,75.40625 52.078125x17.46875]
BlockContainer <td> at (11,74) content-size 70.046875x17 table-cell [BFC] children: inline
line 0 width: 52.078125, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 5, rect: [11,74 52.078125x17]
"Row 2"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <td> at (85.046875,75.40625) content-size 72.515625x17.46875 table-cell [BFC] children: inline
line 0 width: 43.953125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 6, rect: [85.046875,75.40625 43.953125x17.46875]
BlockContainer <td> at (85.046875,74) content-size 72.515625x17 table-cell [BFC] children: inline
line 0 width: 43.953125, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 6, rect: [85.046875,74 43.953125x17]
"Cell 5"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <td> at (161.5625,75.40625) content-size 72.796875x17.46875 table-cell [BFC] children: inline
line 0 width: 44.234375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 6, rect: [161.5625,75.40625 44.234375x17.46875]
BlockContainer <td> at (161.5625,74) content-size 72.796875x17 table-cell [BFC] children: inline
line 0 width: 44.234375, height: 17, bottom: 17, baseline: 13.296875
frag 0 from TextNode start: 0, length: 6, rect: [161.5625,74 44.234375x17]
"Cell 6"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <(anonymous)> (not painted) children: inline
TextNode <#text>
BlockContainer <(anonymous)> at (8,95.875) content-size 784x0 children: inline
BlockContainer <(anonymous)> at (8,94) content-size 784x0 children: inline
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x103.875]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x102]
PaintableWithLines (BlockContainer(anonymous)) [0,0 800x0]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x87.875]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x86]
PaintableWithLines (BlockContainer(anonymous)) [8,8 784x0]
PaintableWithLines (TableWrapper(anonymous)) [8,8 229.359375x87.875]
PaintableBox (Box<TABLE>) [8,8 229.359375x87.875]
PaintableBox (Box<TBODY>) [8,8 221.359375x77.875] overflow: [8,8 227.359375x85.875]
PaintableBox (Box<TR>) [10,10 221.359375x19.46875] overflow: [10,10 225.359375x19.46875]
PaintableWithLines (BlockContainer<TH>) [10,10 72.046875x19.46875]
PaintableWithLines (TableWrapper(anonymous)) [8,8 229.359375x86]
PaintableBox (Box<TABLE>) [8,8 229.359375x86]
PaintableBox (Box<TBODY>) [8,8 221.359375x76] overflow: [8,8 227.359375x84]
PaintableBox (Box<TR>) [10,10 221.359375x19] overflow: [10,10 225.359375x19]
PaintableWithLines (BlockContainer<TH>) [10,10 72.046875x19]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<TH>) [84.046875,10 74.515625x19.46875]
PaintableWithLines (BlockContainer<TH>) [84.046875,10 74.515625x19]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<TH>) [160.5625,10 74.796875x19.46875]
PaintableWithLines (BlockContainer<TH>) [160.5625,10 74.796875x19]
TextPaintable (TextNode<#text>)
PaintableBox (Box<TR>) [10,31.46875 221.359375x19.46875] overflow: [10,31.46875 225.359375x40.9375]
PaintableWithLines (BlockContainer<TD>) [10,31.46875 72.046875x40.9375]
PaintableBox (Box<TR>) [10,31 221.359375x19] overflow: [10,31 225.359375x40]
PaintableWithLines (BlockContainer<TD>) [10,31 72.046875x40]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<TD>) [84.046875,31.46875 74.515625x19.46875]
PaintableWithLines (BlockContainer<TD>) [84.046875,31 74.515625x19]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<TD>) [160.5625,31.46875 74.796875x19.46875]
PaintableWithLines (BlockContainer<TD>) [160.5625,31 74.796875x19]
TextPaintable (TextNode<#text>)
PaintableBox (Box<TR>) [10,52.9375 221.359375x19.46875] overflow: [10,52.9375 225.359375x19.46875]
PaintableWithLines (BlockContainer<TD>) [84.046875,52.9375 74.515625x19.46875]
PaintableBox (Box<TR>) [10,52 221.359375x19] overflow: [10,52 225.359375x19]
PaintableWithLines (BlockContainer<TD>) [84.046875,52 74.515625x19]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<TD>) [160.5625,52.9375 74.796875x19.46875]
PaintableWithLines (BlockContainer<TD>) [160.5625,52 74.796875x19]
TextPaintable (TextNode<#text>)
PaintableBox (Box<TR>) [10,74.40625 221.359375x19.46875] overflow: [10,74.40625 225.359375x19.46875]
PaintableWithLines (BlockContainer<TD>) [10,74.40625 72.046875x19.46875]
PaintableBox (Box<TR>) [10,73 221.359375x19] overflow: [10,73 225.359375x19]
PaintableWithLines (BlockContainer<TD>) [10,73 72.046875x19]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<TD>) [84.046875,74.40625 74.515625x19.46875]
PaintableWithLines (BlockContainer<TD>) [84.046875,73 74.515625x19]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<TD>) [160.5625,74.40625 74.796875x19.46875]
PaintableWithLines (BlockContainer<TD>) [160.5625,73 74.796875x19]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [8,95.875 784x0]
PaintableWithLines (BlockContainer(anonymous)) [8,94 784x0]