Skip to content

Truly independent web browser

LibWeb: Include fallback fonts in line-height: normal layout bounds

Shannon Boothd95b00a6db81
diff --git a/Libraries/LibWeb/Rust/src/css/computed_value_views.rs b/Libraries/LibWeb/Rust/src/css/computed_value_views.rs
index 4715fabd653..f87e410bc9e 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_value_views.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_value_views.rs
@@ -810,6 +810,15 @@ impl<'a> ComputedValuesView<'a> {
)
}
+ /// Whether `line-height` computes to `normal`, which sizes an inline box by the metrics of every font its
+ /// glyphs are set in rather than by its first available font alone.
+ pub(crate) fn line_height_is_normal(self) -> bool {
+ matches!(
+ self.font().line_height.data(),
+ Some(StyleValueData::Keyword { keyword }) if *keyword == crate::css::css_enums::keyword::NORMAL
+ )
+ }
+
/// Whether `list-style-type` computes to `none`, the marker that renders nothing.
pub(crate) fn list_style_type_is_none(self) -> bool {
matches!(
diff --git a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
index 03dd7fc84c0..cad87221ae6 100644
--- a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
@@ -1775,7 +1775,7 @@ impl<'context> InlineFormattingContext<'context> {
);
continue;
};
- line_builder.append_text_item(&mut prefix, style.line_height());
+ line_builder.append_text_item(&mut prefix, style);
self.set_current_line_start_offset(item_index, item.offset_in_node);
line_builder.break_line(line_builder::ForcedBreak::No, NodeSlotId::INVALID, None);
}
@@ -2289,7 +2289,7 @@ impl<'context> InlineFormattingContext<'context> {
if self.stops_at_line_clamp_point(line_builder, &mut state_at_clamp_point) {
break;
}
- line_builder.append_text_item(&mut item, style.line_height());
+ line_builder.append_text_item(&mut item, style);
}
}
}
diff --git a/Libraries/LibWeb/Rust/src/layout/line_builder.rs b/Libraries/LibWeb/Rust/src/layout/line_builder.rs
index aa749af3b53..fb673d558b9 100644
--- a/Libraries/LibWeb/Rust/src/layout/line_builder.rs
+++ b/Libraries/LibWeb/Rust/src/layout/line_builder.rs
@@ -458,7 +458,9 @@ impl<'builder, 'context> LineBuilder<'builder, 'context> {
self.max_block_size_on_current_line = self.max_block_size_on_current_line.max(margin_block_size);
}
- pub(crate) fn append_text_item(&mut self, item: &mut inline_level_iterator::Item, content_block_size: CssPixels) {
+ pub(crate) fn append_text_item(&mut self, item: &mut inline_level_iterator::Item, style: StyleValues) {
+ let glyphs = item.glyphs.take().unwrap();
+ let content_block_size = TextLayoutBounds::new(style, Some(&glyphs.font)).block_size();
self.append_text_chunk(
item.node,
item.offset_in_node,
@@ -469,7 +471,7 @@ impl<'builder, 'context> LineBuilder<'builder, 'context> {
item.margin_end,
item.inline_size,
content_block_size,
- item.glyphs.take().unwrap(),
+ glyphs,
item.trailing_whitespace,
);
}
@@ -812,6 +814,16 @@ impl<'builder, 'context> LineBuilder<'builder, 'context> {
.unwrap_or(normal_subtree_shift)
}
+ fn text_fragment_layout_bounds(
+ &self,
+ line_index: usize,
+ fragment_index: usize,
+ style: StyleValues,
+ ) -> TextLayoutBounds {
+ let fragment = &self.line(line_index).fragments[fragment_index];
+ TextLayoutBounds::new(style, fragment.glyphs.as_ref().map(|glyphs| &glyphs.font))
+ }
+
fn inline_box_alignment_metrics(&self, node: Node) -> VerticalAlignMetrics {
let style = self.style(node);
let sides = self.context().sides_of_entered_inline_box(node);
@@ -847,7 +859,8 @@ impl<'builder, 'context> LineBuilder<'builder, 'context> {
};
let style = self.style(style_source);
let fragment_baseline = if is_block_ellipsis || self.facts(node).is_text_node() {
- Self::baseline_for_style(style, style.line_height())
+ self.text_fragment_layout_bounds(line_index, fragment_index, style)
+ .ascent
} else {
let box_cells = box_cells.expect("the fragment of an element item carries the cells of its box");
formatting_context::inline_box_baseline(
@@ -1243,16 +1256,10 @@ impl<'builder, 'context> LineBuilder<'builder, 'context> {
+ atomic_inline.border_box_bottom(false),
)
} else {
- let typographic = CssPixels::nearest_value_for_f32(style.font_ascent() + style.font_descent());
- let half_leading = (style.line_height() - typographic) / 2;
+ let bounds = self.text_fragment_layout_bounds(line_index, fragment_index, style);
(
- snapshot.block_offset + snapshot.baseline
- - CssPixels::nearest_value_for_f32(style.font_ascent())
- - half_leading,
- snapshot.block_offset
- + snapshot.baseline
- + CssPixels::nearest_value_for_f32(style.font_descent())
- + half_leading,
+ snapshot.block_offset + snapshot.baseline - bounds.ascent,
+ snapshot.block_offset + snapshot.baseline + bounds.descent,
)
};
if !alignment_style.vertical_align_is_keyword() {
@@ -1414,6 +1421,43 @@ fn aligned_subtree_shift(subtrees: &[LineRelativeAlignedSubtree], root: Node) ->
.map(|subtree| subtree.shift)
}
+// https://drafts.csswg.org/css-inline-3/#inline-height
+/// The extent of the layout bounds of a text fragment above and below its baseline.
+#[derive(Clone, Copy)]
+pub(crate) struct TextLayoutBounds {
+ pub(crate) ascent: CssPixels,
+ pub(crate) descent: CssPixels,
+}
+
+impl TextLayoutBounds {
+ pub(crate) fn new(style: StyleValues, font: Option<&libgfx_rust::font::FontHandle>) -> Self {
+ let typographic = CssPixels::nearest_value_for_f32(style.font_ascent() + style.font_descent());
+ let half_leading = (style.line_height() - typographic) / 2;
+ let mut bounds = Self {
+ ascent: CssPixels::nearest_value_for_f32(style.font_ascent()) + half_leading,
+ descent: CssPixels::nearest_value_for_f32(style.font_descent()) + half_leading,
+ };
+ // When its computed line-height is normal, the layout bounds of an inline box encloses all its glyphs, going
+ // from the highest A to the deepest D. (Note that glyphs in a single box can come from different fonts and
+ // thus might not all have the same A and D.)
+ // NB: The bounds above already enclose the glyphs of the first available font.
+ if let Some(font) = font
+ && style.line_height_is_normal()
+ && font.as_raw() != style.font().first_available_font
+ {
+ bounds.ascent = bounds.ascent.max(CssPixels::nearest_value_for_f32(font.facts().ascent));
+ bounds.descent = bounds
+ .descent
+ .max(CssPixels::nearest_value_for_f32(font.facts().descent));
+ }
+ bounds
+ }
+
+ pub(crate) fn block_size(self) -> CssPixels {
+ self.ascent + self.descent
+ }
+}
+
pub(crate) fn normal_line_height(style: StyleValues) -> CssPixels {
let ascent = style.font_ascent().round_ties_even() as i64;
let descent = style.font_descent().round_ties_even() as i64;
diff --git a/Tests/LibWeb/Layout/expected/multi-code-point-graphemes.txt b/Tests/LibWeb/Layout/expected/multi-code-point-graphemes.txt
index 8bf395c3dbb..3d813316fc9 100644
--- a/Tests/LibWeb/Layout/expected/multi-code-point-graphemes.txt
+++ b/Tests/LibWeb/Layout/expected/multi-code-point-graphemes.txt
@@ -1,24 +1,24 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 112 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,16] [8+0+0 784 0+0+8] [8+0+0 80 0+0+8] children: not-inline
- BlockContainer <p> at [8,16] [0+0+0 784 0+0+0] [16+0+0 16 0+0+16] children: inline
- frag 0 from TextNode start: 0, length: 5, rect: [8,16 20.3125x16] baseline: 12.796875
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 120.25 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,16] [8+0+0 784 0+0+8] [8+0+0 88.25 0+0+8] children: not-inline
+ BlockContainer <p> at [8,16] [0+0+0 784 0+0+0] [16+0+0 18.75 0+0+16] children: inline
+ frag 0 from TextNode start: 0, length: 5, rect: [8,18.046875 20.3125x16] baseline: 12.796875
"πŸ§‘β€πŸš’"
TextNode <#text> (not painted)
- BlockContainer <(anonymous)> at [8,48] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
+ BlockContainer <(anonymous)> at [8,50.75] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
- BlockContainer <p> at [8,48] [0+0+0 784 0+0+0] [16+0+0 16 0+0+16] children: inline
- frag 0 from TextNode start: 0, length: 5, rect: [8,48 20.3125x16] baseline: 12.796875
+ BlockContainer <p> at [8,50.75] [0+0+0 784 0+0+0] [16+0+0 18.75 0+0+16] children: inline
+ frag 0 from TextNode start: 0, length: 5, rect: [8,52.796875 20.3125x16] baseline: 12.796875
"πŸ΄β€β˜ οΈ"
TextNode <#text> (not painted)
- BlockContainer <(anonymous)> at [8,80] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
+ BlockContainer <(anonymous)> at [8,85.5] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
- BlockContainer <p> at [8,80] [0+0+0 784 0+0+0] [16+0+0 16 0+0+16] children: inline
- frag 0 from TextNode start: 0, length: 11, rect: [8,80 20.3125x16] baseline: 12.796875
+ BlockContainer <p> at [8,85.5] [0+0+0 784 0+0+0] [16+0+0 18.75 0+0+16] children: inline
+ frag 0 from TextNode start: 0, length: 11, rect: [8,87.546875 20.3125x16] baseline: 12.796875
"πŸ§‘β€πŸ§‘β€πŸ§’β€πŸ§’"
TextNode <#text> (not painted)
- BlockContainer <(anonymous)> at [8,112] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
+ BlockContainer <(anonymous)> at [8,120.25] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x112] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x120.25] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/pseudo-element-content-replacement-list-item.txt b/Tests/LibWeb/Layout/expected/pseudo-element-content-replacement-list-item.txt
index 03ad1654eca..3037c6f5304 100644
--- a/Tests/LibWeb/Layout/expected/pseudo-element-content-replacement-list-item.txt
+++ b/Tests/LibWeb/Layout/expected/pseudo-element-content-replacement-list-item.txt
@@ -1,25 +1,25 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 54 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 38 0+0+8] children: not-inline
- BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 38 0+0+0] children: not-inline
- ListItemBox <(anonymous)> at [8,8] [0+0+0 784 0+0+0] [0+0+0 19 0+0+0] children: inline
- frag 0 from ListItemMarkerBox start: 0, length: 0, rect: [8,11 40.625x16] baseline: 12.796875
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 55.5 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 39.5 0+0+8] children: not-inline
+ BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 39.5 0+0+0] children: not-inline
+ ListItemBox <(anonymous)> at [8,8] [0+0+0 784 0+0+0] [0+0+0 19.75 0+0+0] children: inline
+ frag 0 from ListItemMarkerBox start: 0, length: 0, rect: [8,9 40.625x18.75] baseline: 14.84375
frag 1 from ImageBox start: 0, length: 0, rect: [48.625,8 16x16] baseline: 16
- ListItemMarkerBox <(anonymous)> at [8,11] [0+0+0 40.625 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from GeneratedTextNode start: 0, length: 2, rect: [8,11 40.625x16] baseline: 12.796875
+ ListItemMarkerBox <(anonymous)> at [8,9] [0+0+0 40.625 0+0+0] [0+0+0 18.75 0+0+0] [BFC] children: inline
+ frag 0 from GeneratedTextNode start: 0, length: 2, rect: [8,11.046875 40.625x16] baseline: 12.796875
"β–ͺ "
GeneratedTextNode <(anonymous)> (not painted)
ImageBox <(anonymous)> at [48.625,8] [0+0+0 16 0+0+0] [0+0+0 16 0+0+0] children: not-inline
- ListItemBox <(anonymous)> at [8,27] [0+0+0 784 0+0+0] [0+0+0 19 0+0+0] children: inline
- frag 0 from ListItemMarkerBox start: 0, length: 0, rect: [8,30 40.625x16] baseline: 12.796875
- frag 1 from ImageBox start: 0, length: 0, rect: [48.625,27 16x16] baseline: 16
- ListItemMarkerBox <(anonymous)> at [8,30] [0+0+0 40.625 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
- frag 0 from GeneratedTextNode start: 0, length: 2, rect: [8,30 40.625x16] baseline: 12.796875
+ ListItemBox <(anonymous)> at [8,27.75] [0+0+0 784 0+0+0] [0+0+0 19.75 0+0+0] children: inline
+ frag 0 from ListItemMarkerBox start: 0, length: 0, rect: [8,28.75 40.625x18.75] baseline: 14.84375
+ frag 1 from ImageBox start: 0, length: 0, rect: [48.625,27.75 16x16] baseline: 16
+ ListItemMarkerBox <(anonymous)> at [8,28.75] [0+0+0 40.625 0+0+0] [0+0+0 18.75 0+0+0] [BFC] children: inline
+ frag 0 from GeneratedTextNode start: 0, length: 2, rect: [8,30.796875 40.625x16] baseline: 12.796875
"β–ͺ "
GeneratedTextNode <(anonymous)> (not painted)
- ImageBox <(anonymous)> at [48.625,27] [0+0+0 16 0+0+0] [0+0+0 16 0+0+0] children: not-inline
- BlockContainer <(anonymous)> at [8,46] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
+ ImageBox <(anonymous)> at [48.625,27.75] [0+0+0 16 0+0+0] [0+0+0 16 0+0+0] children: not-inline
+ BlockContainer <(anonymous)> at [8,47.5] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x54] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x55.5] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/soft-wrap-opportunity-between-regional-indicators.txt b/Tests/LibWeb/Layout/expected/soft-wrap-opportunity-between-regional-indicators.txt
index f631d4ddd63..03d94a604a2 100644
--- a/Tests/LibWeb/Layout/expected/soft-wrap-opportunity-between-regional-indicators.txt
+++ b/Tests/LibWeb/Layout/expected/soft-wrap-opportunity-between-regional-indicators.txt
@@ -1,39 +1,39 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 124 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 106 0+0+8] children: not-inline
- BlockContainer <div> at [8,8] [0+0+0 0 0+0+784] [0+0+0 64 0+0+10] children: inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 137.75 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 119.75 0+0+8] children: not-inline
+ BlockContainer <div> at [8,8] [0+0+0 0 0+0+784] [0+0+0 72.25 0+0+10] children: inline
frag 0 from TextNode start: 0, length: 1, rect: [8,8 9.703125x16] baseline: 12.796875
"x"
- frag 1 from TextNode start: 1, length: 4, rect: [8,24 20.3125x16] baseline: 12.796875
+ frag 1 from TextNode start: 1, length: 4, rect: [8,26.046875 20.3125x16] baseline: 12.796875
"πŸ‡ΊπŸ‡Έ"
- frag 2 from TextNode start: 5, length: 4, rect: [8,40 20.3125x16] baseline: 12.796875
+ frag 2 from TextNode start: 5, length: 4, rect: [8,44.046875 20.3125x16] baseline: 12.796875
"πŸ‡ΊπŸ‡Έ"
- frag 3 from TextNode start: 9, length: 2, rect: [8,56 20.3125x16] baseline: 12.796875
+ frag 3 from TextNode start: 9, length: 2, rect: [8,63.046875 20.3125x16] baseline: 12.796875
"πŸ‡Ί"
TextNode <#text> (not painted)
- InlineNode <b> at [28.3125,56] [0+0+0 20.3125 0+0+0] [0+0+0 16 0+0+0]
- frag 0 from TextNode start: 0, length: 2, rect: [28.3125,56 20.3125x16] baseline: 12.796875
+ InlineNode <b> at [28.3125,63.046875] [0+0+0 20.3125 0+0+0] [0+0+0 16 0+0+0]
+ frag 0 from TextNode start: 0, length: 2, rect: [28.3125,63.046875 20.3125x16] baseline: 12.796875
"πŸ‡Έ"
TextNode <#text> (not painted)
- BlockContainer <(anonymous)> at [8,82] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
+ BlockContainer <(anonymous)> at [8,90.25] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
- BlockContainer <div> at [8,82] [0+0+0 0 0+0+784] [0+0+0 32 0+0+10] children: inline
- frag 0 from TextNode start: 0, length: 2, rect: [8,82 20.3125x16] baseline: 12.796875
+ BlockContainer <div> at [8,90.25] [0+0+0 0 0+0+784] [0+0+0 37.5 0+0+10] children: inline
+ frag 0 from TextNode start: 0, length: 2, rect: [8,92.296875 20.3125x16] baseline: 12.796875
"πŸ‡Ί"
- frag 1 from TextNode start: 0, length: 2, rect: [8,98 20.3125x16] baseline: 12.796875
+ frag 1 from TextNode start: 0, length: 2, rect: [8,110.296875 20.3125x16] baseline: 12.796875
"πŸ‡Ί"
TextNode <#text> (not painted)
- InlineNode <b> at [28.3125,82] [0+0+0 20.3125 0+0+0] [0+0+0 16 0+0+0]
- frag 0 from TextNode start: 0, length: 2, rect: [28.3125,82 20.3125x16] baseline: 12.796875
+ InlineNode <b> at [28.3125,92.296875] [0+0+0 20.3125 0+0+0] [0+0+0 16 0+0+0]
+ frag 0 from TextNode start: 0, length: 2, rect: [28.3125,92.296875 20.3125x16] baseline: 12.796875
"πŸ‡Έ"
TextNode <#text> (not painted)
TextNode <#text> (not painted)
- InlineNode <b> at [28.3125,98] [0+0+0 20.3125 0+0+0] [0+0+0 16 0+0+0]
- frag 0 from TextNode start: 0, length: 2, rect: [28.3125,98 20.3125x16] baseline: 12.796875
+ InlineNode <b> at [28.3125,110.296875] [0+0+0 20.3125 0+0+0] [0+0+0 16 0+0+0]
+ frag 0 from TextNode start: 0, length: 2, rect: [28.3125,110.296875 20.3125x16] baseline: 12.796875
"πŸ‡Έ"
TextNode <#text> (not painted)
- BlockContainer <(anonymous)> at [8,124] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
+ BlockContainer <(anonymous)> at [8,137.75] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x124] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x137.75] (z-index: auto)
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/content-height-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/content-height-001-ref.html
new file mode 100644
index 00000000000..d6ca716b0cb
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/content-height-001-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Test Reference file</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<style>
+
+div { font-size: 50px; display: inline-block; color: transparent; }
+
+span { background: blue; }
+
+div { line-height: 200px; }
+</style>
+
+<p>Test passes if the blue shape below is a rectangle, but not some other polygon.
+
+<div><span>aa</span></div><div><span>aa</span></div><div><span>aa</span></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/content-height-003-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/content-height-003-ref.html
new file mode 100644
index 00000000000..71c0a72507b
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/content-height-003-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Test Reference file</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<style>
+@font-face {
+ font-family: 'high-a-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../../fonts/Revalia.woff) format('woff');
+ unicode-range: U+0061, U+0020;
+}
+@font-face {
+ font-family: 'deep-b-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../../fonts/AD.woff) format('woff');
+ unicode-range: U+0062, U+0020;
+}
+
+div {
+ font-size: 50px;
+ display: inline-block;
+ color: transparent;
+ font-family: high-a-only, deep-b-only;
+}
+
+span { background: blue; }
+
+div { line-height: 200px; }
+</style>
+
+<p>Test passes if the blue shape below is a rectangle, but not some other polygon.
+
+<div><span>bb</span></div><div><span>bb</span></div><div><span>bb</span></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/content-height-004-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/content-height-004-ref.html
new file mode 100644
index 00000000000..88f899c04b6
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/content-height-004-ref.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS2 Line height test: explicit sizing</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<style>
+@font-face {
+ font-family: 'high-a-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../../fonts/Revalia.woff) format('woff');
+ unicode-range: U+0061, U+0020;
+}
+
+div {
+ font-size: 50px;
+ display: inline-block;
+ color: transparent;
+}
+
+span { background: blue; }
+
+div { font-family: high-a-only }
+aside {
+ max-width: 300px;
+ overflow: hidden;
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the blue shape below is a rectangle, but not some other polygon.
+
+<aside>
+<div><span>aaaaaaaaa</span></div>
+</aside>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-201-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-201-ref.html
new file mode 100644
index 00000000000..3564bf77858
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-201-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Test Reference file</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<style>
+div {
+ position: absolute;
+ width: 100px;
+ height: 100px;
+ background: green;
+}
+</style>
+
+<p>Test passes if there is a <strong>green square</strong> and <strong>no red</strong> below.
+
+<div></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-202-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-202-ref.html
new file mode 100644
index 00000000000..2b77a6b3dd3
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-202-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Test Reference file</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+
+<p>Test passes if there is <strong>no red</strong> below.
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-203-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-203-ref.html
new file mode 100644
index 00000000000..ec605c76a91
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-203-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Test Reference file</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+
+<p>Test passes if there is a small green rectangle or square below.
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-206-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-206-ref.html
new file mode 100644
index 00000000000..f1d1c516227
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/CSS2/visudet/reference/line-height-206-ref.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Test Reference file</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<style>
+@font-face {
+ font-family: 'high-a-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../../fonts/Revalia.woff) format('woff');
+ unicode-range: U+0061;
+}
+
+div {
+ position: absolute;
+ line-height: normal;
+ font-size: 100px;
+ color: transparent;
+ border: solid black 1px;
+ font-family: high-a-only;
+}
+</style>
+
+<p>There should be two stacked rectangles below: a tall one above a short one, both the same width, sharing the edge at which they touch.
+
+<div>a</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/fonts/AD.woff b/Tests/LibWeb/Ref/expected/wpt-import/fonts/AD.woff
new file mode 100644
index 00000000000..3df8ea8efda
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/fonts/AD.woff differ
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/fonts/Revalia.woff b/Tests/LibWeb/Ref/expected/wpt-import/fonts/Revalia.woff
new file mode 100644
index 00000000000..631bee6de90
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/fonts/Revalia.woff differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/content-height-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/content-height-001.html
new file mode 100644
index 00000000000..a8cd2ec4364
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/content-height-001.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS2 inline level box content height test</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#line-height">
+<link rel="match" href="../../../../../expected/wpt-import/css/CSS2/visudet/reference/content-height-001-ref.html">
+<meta name="assert" content="The height of the content area of an inline-level box does not depend on the value of the line-height property">
+<style>
+
+div { font-size: 50px; display: inline-block; color: transparent; }
+
+span { background: blue; }
+
+div { line-height: 200px; }
+div:nth-of-type(2) { line-height: 30px; }
+div:nth-of-type(3) { line-height: normal; }
+</style>
+
+<p>Test passes if the blue shape below is a rectangle, but not some other polygon.
+
+<div><span>aa</span></div><div><span>aa</span></div><div><span>aa</span></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/content-height-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/content-height-003.html
new file mode 100644
index 00000000000..8acb7db6cef
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/content-height-003.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS2 inline level box content height test</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#line-height">
+<link rel="match" href="../../../../../expected/wpt-import/css/CSS2/visudet/reference/content-height-003-ref.html">
+<meta name="assert" content="The height of the content area of an inline-level box does not depend on the value of the line-height property,
+ even when fallback fonts are used at the exclusion of the first available font">
+<style>
+@font-face {
+ font-family: 'high-a-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/Revalia.woff) format('woff');
+ unicode-range: U+0061, U+0020;
+}
+@font-face {
+ font-family: 'deep-b-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/AD.woff) format('woff');
+ unicode-range: U+0062, U+0020;
+}
+
+div {
+ font-size: 50px;
+ display: inline-block;
+ color: transparent;
+ font-family: high-a-only, deep-b-only;
+}
+
+span { background: blue; }
+
+div { line-height: 200px; }
+div:nth-of-type(2) { line-height: 30px; }
+div:nth-of-type(3) { line-height: normal; }
+</style>
+
+<p>Test passes if the blue shape below is a rectangle, but not some other polygon.
+
+<div><span>bb</span></div><div><span>bb</span></div><div><span>bb</span></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/content-height-004.html b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/content-height-004.html
new file mode 100644
index 00000000000..157fc065a4c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/content-height-004.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS2 inline level box content height test</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#line-height">
+<link rel="match" href="../../../../../expected/wpt-import/css/CSS2/visudet/reference/content-height-004-ref.html">
+<meta name="fuzzy" content="maxDifference=0-255; totalPixels=0-150">
+<meta name="assert" content="The height of the content area of an inline-level does not depend on fallback fonts
+ regardless of whether they are used on not.">
+<style>
+@font-face {
+ font-family: 'high-a-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/Revalia.woff) format('woff');
+ unicode-range: U+0061, U+0020;
+}
+@font-face {
+ font-family: 'deep-b-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/AD.woff) format('woff');
+ unicode-range: U+0062, U+0020;
+}
+
+div {
+ font-size: 50px;
+ display: inline-block;
+ color: transparent;
+ font-family: high-a-only, deep-b-only;
+}
+
+span { background: blue; }
+
+div { }
+div:nth-of-type(2) { }
+div:nth-of-type(3) { }
+div:nth-of-type(4) { font-family: high-a-only }
+aside {
+ max-width: 300px;
+ overflow: hidden;
+ white-space: pre;
+}
+</style>
+
+<p>Test passes if the blue shape below is a rectangle, but not some other polygon.
+
+<aside>
+<div><span>aa</span></div><div><span>bb</span></div><div><span>ab</span></div><div><span>aaa</span></div>
+</aside>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-201.html b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-201.html
new file mode 100644
index 00000000000..c5a85e9a37d
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-201.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS2 Line height test: explicit sizing</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#line-height">
+<link rel="match" href="../../../../../expected/wpt-import/css/CSS2/visudet/reference/line-height-201-ref.html">
+<meta name="assert" content="non-normal values of line-height result in the height of the inline-level box to be exactly the specified dimention,
+ even when fallback fonts with metrics different from the first available font one are used.">
+<style>
+@font-face {
+ font-family: 'high-a-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/Revalia.woff) format('woff');
+ unicode-range: U+0020, U+0061;
+}
+@font-face {
+ font-family: 'deep-b-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/AD.woff) format('woff');
+ unicode-range: U+0062;
+}
+
+#red { /* red to be uncovered if the test divs aren't tall enough */
+ position: absolute;
+ background: red;
+ width: 100px;
+ height: 100px;
+}
+
+div:not(#red) {
+ position: absolute;
+ width: 50px;
+ line-height: 100px;
+ font-family: high-a-only, deep-b-only;
+ background: url("support/1x1-green.png") 0 0 / 50px 100px no-repeat, red; /* gets red if the div is too large */
+ color: transparent;
+}
+#test {
+ font-size: 20px; /* With a font-size smaller than the line-height */
+}
+#test2 {
+ margin-left: 50px;
+ font-size: 150px; /* With a font-size larger than the line-height */
+}
+</style>
+
+<p>Test passes if there is a <strong>green square</strong> and <strong>no red</strong> below.
+
+<div id=red></div>
+
+<div id=test>ab</div>
+<div id=test2>ab</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-202.html b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-202.html
new file mode 100644
index 00000000000..06508f3ea12
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-202.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS2 Line height test: baseline position when explicit sizing</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#line-height">
+<link rel="match" href="../../../../../expected/wpt-import/css/CSS2/visudet/reference/line-height-202-ref.html">
+<meta name="assert" content="The position of the baseline in an inline-level box whose height is determined by a non-normal value of line-height
+ does not depend on fonts other than the first available font">
+<style>
+@font-face {
+ font-family: 'high-a-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/Revalia.woff) format('woff');
+ unicode-range: U+0020, U+0061;
+}
+@font-face {
+ font-family: 'deep-b-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/AD.woff) format('woff');
+ unicode-range: U+0062;
+}
+
+div {
+ position: absolute;
+ line-height: 100px;
+ font-size: 100px;
+ width: 300px; /* plenty of room for the (invisible) text */
+ text-align: right;
+ color: transparent;
+}
+span { /* visible thing aligned to the baseline, and small enough to not influence its position */
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+
+}
+
+/* white #h is on top of red #hd,
+ and the presence of a fallback font in #hd should not influence the position of the baseline,
+ so #h should completely cover #hd,
+ and no red should be visible. */
+#hd { font-family: high-a-only, deep-b-only; }
+#hd span { background: red; }
+
+#h { font-family: high-a-only; }
+#h span { background: white; }
+
+</style>
+
+<p>Test passes if there is <strong>no red</strong> below.
+
+<div id=hd>ab<span></span></div>
+<div id=h>aa<span></span></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-203.html b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-203.html
new file mode 100644
index 00000000000..a0cb343691c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-203.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS2 Line height test: baseline position with explicit sizing</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#line-height">
+<link rel="mismatch" href="../../../../../expected/wpt-import/css/CSS2/visudet/reference/line-height-203-ref.html">
+<meta name="assert" content="The position of the baseline in an inline-level box whose height is determined by a non-normal value of line-height
+ does depend on the first available font.">
+<style>
+@font-face {
+ font-family: 'high';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/Revalia.woff) format('woff');
+}
+@font-face {
+ font-family: 'deep';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/AD.woff) format('woff');
+}
+
+div {
+ position: absolute;
+ line-height: 100px;
+ font-size: 100px;
+ width: 300px; /* plenty of room for the (invisible) text */
+ text-align: right;
+ color: transparent;
+}
+span { /* visible thing aligned to the baseline, and small enough to not influence its position */
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+}
+
+/* white #h is on top of green #d,
+ but as they have different primary fonts,
+ their baselines should not line up and green #d should be visible.*/
+#d { font-family: deep; }
+#d span { background: green; }
+
+#h { font-family: high; }
+#h span { background: white; }
+
+</style>
+
+<p>Test passes if there is a small green rectangle or square below.
+
+<div id=d>aa<span></span></div>
+<div id=h>aa<span></span></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-204.html b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-204.html
new file mode 100644
index 00000000000..eb05da5fb0e
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-204.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<meta charset="utf-8">
+<title>CSS2 Line height test: baseline position, normal sizing vs explicit sizing</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#line-height">
+<link rel="match" href="../../../../../expected/wpt-import/css/CSS2/visudet/reference/line-height-202-ref.html">
+<meta name="assert" content="The position of the baseline in an inline-level box whose line-height is normal
+ and the position of the baseline in an inline-level box whose line-height is set to a non normal value resulting in the same height
+ are the same,
+ assuming only the first available font is used.">
+<style>
+@font-face {
+ font-family: 'high';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/Revalia.woff) format('woff');
+}
+
+div {
+ position: absolute;
+ font-size: 100px;
+ width: 2em; /* plenty of room for the (invisible) text */
+ text-align: right;
+ color: transparent;
+}
+span { /* visible thing aligned to the baseline, and small enough to not influence its position */
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+}
+
+/* white #lh-auto is on top of red #lh-manual,
+ and as their baselines should line up
+ #lh-manual should be fully covered,
+ and no red should be visible */
+#lh-manual { font-family: high; }
+#lh-manual span { background: red; }
+
+#lh-auto { font-family: high; line-height: normal; }
+#lh-auto span { background: white; }
+
+</style>
+
+<body onload="measure()">
+<p>Test passes if there is <strong>no red</strong> below.
+
+<div id=lh-manual>a<span></span></div>
+<div id=lh-auto>a<span></span></div>
+
+<script>
+function measure() { /* let layout complete first, so that we can measure things */
+ var lha = document.getElementById("lh-auto");
+ var lhm = document.getElementById("lh-manual")
+ var h = window.getComputedStyle(lha).height; /*getting the used-value of line-height by proxy */
+ lhm.style.lineHeight = h;
+ document.documentElement.className = "";
+}
+</script>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-205.html b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-205.html
new file mode 100644
index 00000000000..d3a560de9eb
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-205.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS2 Line height test: normal sizing</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#line-height">
+<link rel="match" href="../../../../../expected/wpt-import/css/CSS2/visudet/reference/line-height-202-ref.html">
+<meta name="assert" content="The height of an inline-level box whose line-height is normal and uses both the first available font and fallback fonts
+ is the same as the union of
+ baseline-aligned adjacent inline-level boxes, each using the various fonts as their primary one.">
+<style>
+@font-face {
+ font-family: 'high-a-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/Revalia.woff) format('woff');
+ unicode-range: U+0020, U+0061;
+}
+@font-face {
+ font-family: 'deep-b-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/AD.woff) format('woff');
+ unicode-range: U+0020, U+0062;
+}
+
+div {
+ position: absolute;
+ line-height: normal;
+ font-size: 100px;
+ color: transparent;
+}
+
+.h { font-family: high-a-only; }
+.d { font-family: deep-b-only; }
+.hd { font-family: high-a-only, deep-b-only; }
+.white { background: white; }
+.red { background: red; }
+.shift { margin-left: 300px; }
+</style>
+
+<p>Test passes if there is <strong>no red</strong> below.
+
+<!-- Check if the hd div is larger-->
+
+<div class="hd red">ab</div>
+<div class=white><span class=h>a</span><span class=d>b</span></div>
+
+<!-- Same thing, reversed, to check if the hd dix is smaller -->
+
+<div class="red shift"><span class=h>a</span><span class=d>b</span></div>
+<div class="hd white shift">ab</div>
+
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-206.html b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-206.html
new file mode 100644
index 00000000000..71e1c6a0984
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/line-height-206.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS2 Line height test: normal sizing with fallback fonts</title>
+<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
+<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#line-height">
+<link rel="mismatch" href="../../../../../expected/wpt-import/css/CSS2/visudet/reference/line-height-206-ref.html">
+<meta name="assert" content="The height of an inline-level box whose line-height is normal and which only uses glyphs from the fallback font
+ must still take the strut from the first available font into account.">
+<style>
+@font-face {
+ font-family: 'high-a-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/Revalia.woff) format('woff');
+ unicode-range: U+0061, U+0020;
+}
+@font-face {
+ font-family: 'deep-b-only';
+ font-style: normal;
+ font-weight: 400;
+ src: url(../../../fonts/AD.woff) format('woff');
+ unicode-range: U+0062, U+0020;
+}
+
+div {
+ position: absolute;
+ line-height: normal;
+ font-size: 100px;
+ color: transparent;
+ border: solid black 1px;
+}
+
+.h { font-family: high-a-only; }
+.dh { font-family: deep-b-only, high-a-only; }
+</style>
+
+<p>There should be two stacked rectangles below: a tall one above a short one, both the same width, sharing the edge at which they touch.
+
+<!-- Both divs show the same content with the same font,
+ but the first div has an unused first available font
+ while the second one does not.
+ As the height calculation takes the strut into account,
+ these two boxes should have different heights -->
+<div class="dh">a</div>
+<div class="h">a</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/support/1x1-green.png b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/support/1x1-green.png
new file mode 100644
index 00000000000..b98ca0ba0a0
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/css/CSS2/visudet/support/1x1-green.png differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/fonts/AD.woff b/Tests/LibWeb/Ref/input/wpt-import/fonts/AD.woff
new file mode 100644
index 00000000000..3df8ea8efda
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/fonts/AD.woff differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/fonts/Revalia.woff b/Tests/LibWeb/Ref/input/wpt-import/fonts/Revalia.woff
new file mode 100644
index 00000000000..631bee6de90
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/fonts/Revalia.woff differ