From cfc99666546a82c40286ad732474f675e60817a5 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sun, 19 Mar 2023 23:55:03 +0000 Subject: [PATCH] LibWeb: Add scaleable checkboxes (with theme/accent-color support) This reworks checkboxes to use a tiny 16x16 SDF for the tick icon along with an antialiased background/border. The checkbox now works well at any scale, shows the various checkbox state (enabled, disabled, being pressed), and supports using the colors from the active system theme and/or the accent-color property. --- Userland/Libraries/LibWeb/CSS/Default.css | 27 ---- .../LibWeb/Painting/CheckBoxPaintable.cpp | 128 +++++++++++++++++- .../LibWeb/Painting/CheckBoxPaintable.h | 2 + 3 files changed, 129 insertions(+), 28 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Default.css b/Userland/Libraries/LibWeb/CSS/Default.css index 8224e05ad87..c42ad126400 100644 --- a/Userland/Libraries/LibWeb/CSS/Default.css +++ b/Userland/Libraries/LibWeb/CSS/Default.css @@ -64,33 +64,6 @@ 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; - background-repeat: no-repeat; - background-size: cover; -} - -input[type=checkbox]:checked { - /* - This roughly resembles ClassicStylePainter's paint_check_box() while uncoupling the styling from LibGfx, similar to -