From 2ad9c1fd6cc46183f0a57e30cd36a64afe5a42e8 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 11 Feb 2023 21:45:53 +0000 Subject: [PATCH] LibWeb: Re-implement checkbox painting using the UA stylesheet The checkbox provided by ClassicStylePainter is not scaling-aware and generally unflexible, instead use the UA default stylesheet with a handful of properties, the same way we already style buttons and text inputs. Thanks to Xexxa for the nice checkmark image! Co-Authored-By: Xexxa <93391300+Xexxa@users.noreply.github.com> --- Userland/Libraries/LibWeb/CSS/Default.css | 19 +++++++++++++++++++ .../LibWeb/Painting/CheckBoxPaintable.cpp | 13 ------------- .../LibWeb/Painting/CheckBoxPaintable.h | 2 -- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Default.css b/Userland/Libraries/LibWeb/CSS/Default.css index c42ad12640..7baf6dfc2c 100644 --- a/Userland/Libraries/LibWeb/CSS/Default.css +++ b/Userland/Libraries/LibWeb/CSS/Default.css @@ -64,6 +64,25 @@ button:hover, input[type=submit]:hover, input[type=button]:hover, input[type=res background-color: -libweb-palette-hover-highlight; } +input[type=checkbox] { + display: inline-block; + width: 12px; + height: 12px; + margin: 2px; + border: 1px solid -libweb-palette-threed-shadow1; +} + +input[type=checkbox]:checked { + /* + This roughly resembles ClassicStylePainter's paint_check_box() while uncoupling the styling from LibGfx, similar to +