diff --git a/Libraries/LibWeb/Layout/LineBuilder.cpp b/Libraries/LibWeb/Layout/LineBuilder.cpp index 89f16e12bf3..8e20618e6db 100644 --- a/Libraries/LibWeb/Layout/LineBuilder.cpp +++ b/Libraries/LibWeb/Layout/LineBuilder.cpp @@ -327,9 +327,14 @@ void LineBuilder::update_last_line() auto const x_height = CSSPixels::nearest_value_for(m_context.containing_block().first_available_font().pixel_metrics().x_height); return m_current_block_offset + line_box_baseline + ((effective_box_top_offset - effective_box_bottom_offset - x_height - fragment.height()) / 2); } + case CSS::VerticalAlign::Super: + // https://drafts.csswg.org/css-inline/#valdef-baseline-shift-super + // Raise by the offset appropriate for superscripts of the parent’s box. + // The UA may use the parent’s font metrics to find this offset; otherwise it defaults to raising by one third of the parent’s used font-size. + // FIXME: Use font metrics to find a more appropriate offset, if possible + return alphabetic_baseline - m_context.containing_block().computed_values().font_size() / 3; case CSS::VerticalAlign::Bottom: case CSS::VerticalAlign::Sub: - case CSS::VerticalAlign::Super: case CSS::VerticalAlign::TextBottom: case CSS::VerticalAlign::TextTop: // FIXME: These are all 'baseline'