mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibWeb: Compute text-decoration-thickness
values
This commit is contained in:
parent
0f7156ed81
commit
b6b116d5f2
3 changed files with 16 additions and 3 deletions
|
@ -70,17 +70,24 @@ void TextNode::paint_text_decoration(Gfx::Painter& painter, LineBoxFragment cons
|
|||
|
||||
auto line_color = computed_values().text_decoration_color();
|
||||
|
||||
int line_thickness = [this] {
|
||||
CSS::Length computed_thickness = computed_values().text_decoration_thickness().resolved(*this, CSS::Length(1, CSS::Length::Type::Em));
|
||||
if (computed_thickness.is_auto())
|
||||
return CSS::InitialValues::text_decoration_thickness().to_px(*this);
|
||||
|
||||
return computed_thickness.to_px(*this);
|
||||
}();
|
||||
|
||||
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, line_color);
|
||||
painter.draw_line(line_start_point, line_end_point, line_color, line_thickness);
|
||||
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, line_color, 2);
|
||||
painter.draw_triangle_wave(line_start_point, line_end_point, line_color, line_thickness + 1, line_thickness);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue