1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

LibWeb: Consider TextDecorationStyle when rendering text

For now only Wavy is additionally supported, but the infrastructure is
there.
This commit is contained in:
Tobias Christiansen 2022-01-20 20:30:00 +01:00 committed by Ali Mohammad Pur
parent 69aac6ecd7
commit 3b877c889b

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -67,7 +68,19 @@ void TextNode::paint_text_decoration(Gfx::Painter& painter, LineBoxFragment cons
return;
}
painter.draw_line(line_start_point, line_end_point, computed_values().color());
switch (computed_values().text_decoration_style()) {
// FIXME: Implement the other styles
case CSS::TextDecorationStyle::Solid:
case CSS::TextDecorationStyle::Double:
case CSS::TextDecorationStyle::Dashed:
case CSS::TextDecorationStyle::Dotted:
painter.draw_line(line_start_point, line_end_point, computed_values().color());
break;
case CSS::TextDecorationStyle::Wavy:
// FIXME: There is a thing called text-decoration-thickness which also affects the amplitude here.
painter.draw_triangle_wave(line_start_point, line_end_point, computed_values().color(), 2);
break;
}
}
void TextNode::paint_fragment(PaintContext& context, const LineBoxFragment& fragment, PaintPhase phase) const