mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:47:34 +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:
parent
69aac6ecd7
commit
3b877c889b
1 changed files with 14 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +68,19 @@ void TextNode::paint_text_decoration(Gfx::Painter& painter, LineBoxFragment cons
|
||||||
return;
|
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
|
void TextNode::paint_fragment(PaintContext& context, const LineBoxFragment& fragment, PaintPhase phase) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue