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

LibWeb: Make default text-decoration-thickness a fraction of font height

Previously the default was always 1px, which didn't look great on higher
font sizes.

This changes the default thickness to one-tenth to the font height. The
one-tenth part was chosen arbitrarily, but I think it does the job
pretty well. :^)
This commit is contained in:
Karol Kosek 2022-04-04 22:00:09 +02:00 committed by Linus Groh
parent df9a833d7a
commit 119873b822
2 changed files with 2 additions and 2 deletions

View file

@ -25,7 +25,7 @@ public:
static CSS::TextJustify text_justify() { return CSS::TextJustify::Auto; }
static CSS::Position position() { return CSS::Position::Static; }
static CSS::TextDecorationLine text_decoration_line() { return CSS::TextDecorationLine::None; }
static CSS::Length text_decoration_thickness() { return Length::make_px(1); }
static CSS::Length text_decoration_thickness() { return Length::make_auto(); }
static CSS::TextDecorationStyle text_decoration_style() { return CSS::TextDecorationStyle::Solid; }
static CSS::TextTransform text_transform() { return CSS::TextTransform::None; }
static CSS::Display display() { return CSS::Display { CSS::Display::Outside::Inline, CSS::Display::Inside::Flow }; }

View file

@ -324,7 +324,7 @@ static void paint_text_decoration(Gfx::Painter& painter, Layout::Node const& tex
int line_thickness = [&] {
CSS::Length computed_thickness = text_node.computed_values().text_decoration_thickness().resolved(text_node, CSS::Length(1, CSS::Length::Type::Em));
if (computed_thickness.is_auto())
return CSS::InitialValues::text_decoration_thickness().to_px(text_node);
return max(glyph_height * 0.1f, 1.f);
return computed_thickness.to_px(text_node);
}();