1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:47:37 +00:00

LibWeb: Use PaintableFragment::baseline() in paint_text_decoration()

No need to calculate baseline based on glyph height when we can get
this information from a fragment.
This commit is contained in:
Aliaksandr Kalenik 2024-01-25 18:09:38 +01:00 committed by Andreas Kling
parent 1c4ce2c5f1
commit d5e3158cfe
4 changed files with 49 additions and 1 deletions

View file

@ -505,7 +505,7 @@ void paint_text_decoration(PaintContext& context, Layout::Node const& text_node,
auto& font = fragment.layout_node().first_available_font();
auto fragment_box = fragment.absolute_rect();
CSSPixels glyph_height = CSSPixels::nearest_value_for(font.pixel_size());
auto baseline = fragment_box.height() / 2 - (glyph_height + 4) / 2 + glyph_height;
auto baseline = fragment.baseline();
auto line_color = text_node.computed_values().text_decoration_color();