Fix precision issue with line heights (#33438)

When computing the ascent and descent in an inline formatting context,
we weren't taking into account that app units have precision limitations.
Therefore, in some cases we were getting a line height that was slightly
taller than the value specified in `line-height`.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Oriol Brufau 2024-09-13 18:56:14 +02:00 committed by GitHub
parent a76daaf04c
commit fa8752df6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 5 additions and 41 deletions

View file

@ -1815,8 +1815,12 @@ impl InlineContainerState {
ascent = font_metrics_of_first_font.ascent;
descent = font_metrics_of_first_font.descent;
let half_leading = (line_height - (ascent + descent)).scale_by(0.5);
// We want the sum of `ascent` and `descent` to equal `line_height`.
// If we just add `half_leading` to both, then we may not get `line_height`
// due to precision limitations of `Au`. Instead, we set `descent` to
// the value that will guarantee the correct sum.
ascent += half_leading;
descent += half_leading;
descent = line_height - ascent;
}
LineBlockSizes {

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b01.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b02.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b03.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b04.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b05.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b06.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b07.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b08.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b09.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b10.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b11.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003b12.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003c01.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003c02.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003c03.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003c04.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003c05.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003c06.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003c07.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[fixed-table-layout-003c08.xht]
expected: FAIL