diff options
author | Tobias Christiansen <tobyase@serenityos.org> | 2022-01-20 20:30:00 +0100 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-01-23 15:48:27 +0330 |
commit | 3b877c889b8d2558ed0a73f6c4b2e3bc6660f5ca (patch) | |
tree | 0c50a726d3111ef20d12c28982a3f6640abad953 /Userland/Libraries/LibWeb | |
parent | 69aac6ecd71b584c4daeaedbd32b87810f118d47 (diff) | |
download | serenity-3b877c889b8d2558ed0a73f6c4b2e3bc6660f5ca.zip |
LibWeb: Consider TextDecorationStyle when rendering text
For now only Wavy is additionally supported, but the infrastructure is
there.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/TextNode.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/TextNode.cpp b/Userland/Libraries/LibWeb/Layout/TextNode.cpp index b53d42d5ea..ba766ec9f9 100644 --- a/Userland/Libraries/LibWeb/Layout/TextNode.cpp +++ b/Userland/Libraries/LibWeb/Layout/TextNode.cpp @@ -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 |