From ce5cd012b99063d7291439eaefabfba422fa20e6 Mon Sep 17 00:00:00 2001 From: Gingeh <39150378+Gingeh@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:59:09 +1100 Subject: [PATCH] LibWeb/CSS: Implement the color-scheme CSS property --- Base/res/ladybird/inspector.css | 6 +- Base/res/ladybird/newtab.html | 7 +- Base/res/ladybird/templates/directory.html | 11 +- Base/res/ladybird/templates/error.html | 8 +- Base/res/ladybird/templates/version.html | 8 +- Libraries/LibWeb/CMakeLists.txt | 1 + Libraries/LibWeb/CSS/CSSStyleValue.cpp | 7 + Libraries/LibWeb/CSS/CSSStyleValue.h | 5 + Libraries/LibWeb/CSS/ComputedProperties.cpp | 29 ++ Libraries/LibWeb/CSS/ComputedProperties.h | 1 + Libraries/LibWeb/CSS/ComputedValues.h | 5 + Libraries/LibWeb/CSS/Default.css | 22 +- Libraries/LibWeb/CSS/Parser/Parser.cpp | 70 +++ Libraries/LibWeb/CSS/Parser/Parser.h | 1 + Libraries/LibWeb/CSS/Properties.json | 6 + .../CSS/StyleValues/CSSKeywordValue.cpp | 59 ++- .../CSS/StyleValues/ColorSchemeStyleValue.cpp | 34 ++ .../CSS/StyleValues/ColorSchemeStyleValue.h | 44 ++ Libraries/LibWeb/CSS/SystemColor.cpp | 74 +++- Libraries/LibWeb/CSS/SystemColor.h | 41 +- Libraries/LibWeb/DOM/Document.cpp | 45 +- Libraries/LibWeb/DOM/Document.h | 6 +- Libraries/LibWeb/Forward.h | 1 + Libraries/LibWeb/HTML/HTMLInputElement.cpp | 3 +- Libraries/LibWeb/HTML/HTMLProgressElement.cpp | 4 +- Libraries/LibWeb/Layout/Node.cpp | 10 +- Libraries/LibWeb/Painting/BorderPainting.cpp | 3 +- .../LibWeb/Painting/CheckBoxPaintable.cpp | 6 +- Libraries/LibWeb/Painting/InputColors.h | 23 +- Libraries/LibWeb/Painting/PaintableBox.cpp | 4 +- .../LibWeb/Painting/RadioButtonPaintable.cpp | 5 +- Libraries/LibWebView/ProcessManager.cpp | 10 +- Libraries/LibWebView/SourceHighlighter.h | 11 +- ...upported-properties-and-default-values.txt | 4 +- ...eclaration-has-indexed-property-getter.txt | 411 +++++++++--------- .../css/getComputedStyle-print-all.txt | 3 +- 36 files changed, 618 insertions(+), 370 deletions(-) create mode 100644 Libraries/LibWeb/CSS/StyleValues/ColorSchemeStyleValue.cpp create mode 100644 Libraries/LibWeb/CSS/StyleValues/ColorSchemeStyleValue.h diff --git a/Base/res/ladybird/inspector.css b/Base/res/ladybird/inspector.css index 4ac8f35f72d..c53459e7eae 100644 --- a/Base/res/ladybird/inspector.css +++ b/Base/res/ladybird/inspector.css @@ -4,7 +4,6 @@ @media (prefers-color-scheme: dark) { :root { - --background: rgb(23, 23, 23); --separator: dimgray; --separator-accent: rgb(57, 57, 57); --tab-controls: rgb(57, 57, 57); @@ -30,7 +29,6 @@ @media (prefers-color-scheme: light) { :root { - --background: white; --separator: lightgray; --separator-accent: white; --tab-controls: rgb(229, 229, 229); @@ -54,7 +52,7 @@ } html { - background-color: var(--background); + color-scheme: light dark; } body { @@ -186,7 +184,7 @@ body { left: 0; right: 0; background-color: var(--tab-controls); - border-top: 2px solid var(--background); + border-top: 2px solid Canvas; display: flex; padding: 0.5em; } diff --git a/Base/res/ladybird/newtab.html b/Base/res/ladybird/newtab.html index 68f05d889d4..0471ae776c5 100644 --- a/Base/res/ladybird/newtab.html +++ b/Base/res/ladybird/newtab.html @@ -4,11 +4,8 @@