mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibWeb: Implement missing text-decoration styles
This commit will draw appropriate line styles for the Double, Dashed and Dotted values.
This commit is contained in:
parent
b6b116d5f2
commit
7e599aa1e5
Notes:
sideshowbarker
2024-07-17 17:52:14 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/7e599aa1e5 Pull-request: https://github.com/SerenityOS/serenity/pull/12915 Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 24 additions and 3 deletions
|
@ -79,12 +79,33 @@ void TextNode::paint_text_decoration(Gfx::Painter& painter, LineBoxFragment cons
|
|||
}();
|
||||
|
||||
switch (computed_values().text_decoration_style()) {
|
||||
// FIXME: Implement the other styles
|
||||
case CSS::TextDecorationStyle::Solid:
|
||||
painter.draw_line(line_start_point, line_end_point, line_color, line_thickness, Gfx::Painter::LineStyle::Solid);
|
||||
break;
|
||||
case CSS::TextDecorationStyle::Double:
|
||||
case CSS::TextDecorationStyle::Dashed:
|
||||
case CSS::TextDecorationStyle::Dotted:
|
||||
switch (computed_values().text_decoration_line()) {
|
||||
case CSS::TextDecorationLine::Underline:
|
||||
break;
|
||||
case CSS::TextDecorationLine::Overline:
|
||||
line_start_point.translate_by(0, -line_thickness - 1);
|
||||
line_end_point.translate_by(0, -line_thickness - 1);
|
||||
break;
|
||||
case CSS::TextDecorationLine::LineThrough:
|
||||
line_start_point.translate_by(0, -line_thickness / 2);
|
||||
line_end_point.translate_by(0, -line_thickness / 2);
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
painter.draw_line(line_start_point, line_end_point, line_color, line_thickness);
|
||||
painter.draw_line(line_start_point.translated(0, line_thickness + 1), line_end_point.translated(0, line_thickness + 1), line_color, line_thickness);
|
||||
break;
|
||||
case CSS::TextDecorationStyle::Dashed:
|
||||
painter.draw_line(line_start_point, line_end_point, line_color, line_thickness, Gfx::Painter::LineStyle::Dashed);
|
||||
break;
|
||||
case CSS::TextDecorationStyle::Dotted:
|
||||
painter.draw_line(line_start_point, line_end_point, line_color, line_thickness, Gfx::Painter::LineStyle::Dotted);
|
||||
break;
|
||||
case CSS::TextDecorationStyle::Wavy:
|
||||
painter.draw_triangle_wave(line_start_point, line_end_point, line_color, line_thickness + 1, line_thickness);
|
||||
|
|
Loading…
Reference in a new issue