diff --git a/components/layout/flow/inline/mod.rs b/components/layout/flow/inline/mod.rs index 30099ce27a5..84df84332b4 100644 --- a/components/layout/flow/inline/mod.rs +++ b/components/layout/flow/inline/mod.rs @@ -993,9 +993,11 @@ impl InlineFormattingContextLayout<'_> { return; } - let baseline = baseline_offset + block_start_position; - self.baselines.first.get_or_insert(baseline); - self.baselines.last = Some(baseline); + if line_to_layout.has_content { + let baseline = baseline_offset + block_start_position; + self.baselines.first.get_or_insert(baseline); + self.baselines.last = Some(baseline); + } // The inline part of this start offset was taken into account when determining // the inline start of the line in `calculate_inline_start_for_current_line` so diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 1010c1f3a96..f49618fcb20 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -118868,6 +118868,19 @@ {} ] ], + "inline-block-baseline-015.html": [ + "34b4de90b5432c058c25f54927799ac687d95abd", + [ + null, + [ + [ + "/css/reference/ref-filled-green-200px-square.html", + "==" + ] + ], + {} + ] + ], "line-height-201.html": [ "00ab2aa52755d27c5bbd3b41d91a6f8e138c2899", [ diff --git a/tests/wpt/meta/html/rendering/widgets/button-layout/block-in-inline.html.ini b/tests/wpt/meta/html/rendering/widgets/button-layout/block-in-inline.html.ini deleted file mode 100644 index d342f0c6653..00000000000 --- a/tests/wpt/meta/html/rendering/widgets/button-layout/block-in-inline.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[block-in-inline.html] - expected: FAIL diff --git a/tests/wpt/tests/css/CSS2/visudet/inline-block-baseline-015.html b/tests/wpt/tests/css/CSS2/visudet/inline-block-baseline-015.html new file mode 100644 index 00000000000..34b4de90b54 --- /dev/null +++ b/tests/wpt/tests/css/CSS2/visudet/inline-block-baseline-015.html @@ -0,0 +1,55 @@ + +Vertical-align: baseline of inline-block with phantom line box + + + + + + + + +

Test passes if there is a filled green square and no red.

+ +
+
+
+ +
+
+