mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibWeb: Raise the baseline of text with veritcal-align: super
This raises the baseline of the given text by one third of the parent's font size.
This commit is contained in:
parent
fc45121b70
commit
6fbbbc9b81
Notes:
github-actions[bot]
2025-03-27 23:48:00 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/6fbbbc9b811 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4054
1 changed files with 6 additions and 1 deletions
|
@ -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'
|
||||
|
|
Loading…
Add table
Reference in a new issue