LibWeb: Make text-decoration lines entire width of fragment

This fixes an issue where text decorations (e.g. underlines) of text
split across multiple fragments would have unintended 1px gaps.

Gains us 2 WPT passes (imported)
This commit is contained in:
Callum Law 2025-09-12 01:00:59 +12:00 committed by Tim Ledbetter
parent 858450922b
commit 9aa2d1bd3e
Notes: github-actions[bot] 2025-09-12 06:08:17 +00:00
8 changed files with 154 additions and 4 deletions

View file

@ -841,16 +841,16 @@ void paint_text_decoration(DisplayListRecordingContext& context, TextPaintable c
return;
case CSS::TextDecorationLine::Underline:
line_start_point = context.rounded_device_point(fragment_box.top_left().translated(0, baseline + 2));
line_end_point = context.rounded_device_point(fragment_box.top_right().translated(-1, baseline + 2));
line_end_point = context.rounded_device_point(fragment_box.top_right().translated(0, baseline + 2));
break;
case CSS::TextDecorationLine::Overline:
line_start_point = context.rounded_device_point(fragment_box.top_left().translated(0, baseline - glyph_height));
line_end_point = context.rounded_device_point(fragment_box.top_right().translated(-1, baseline - glyph_height));
line_end_point = context.rounded_device_point(fragment_box.top_right().translated(0, baseline - glyph_height));
break;
case CSS::TextDecorationLine::LineThrough: {
auto x_height = font.x_height();
line_start_point = context.rounded_device_point(fragment_box.top_left().translated(0, baseline - x_height * CSSPixels(0.5f)));
line_end_point = context.rounded_device_point(fragment_box.top_right().translated(-1, baseline - x_height * CSSPixels(0.5f)));
line_end_point = context.rounded_device_point(fragment_box.top_right().translated(0, baseline - x_height * CSSPixels(0.5f)));
break;
}
case CSS::TextDecorationLine::Blink: