style: Initial support for the color-scheme CSS property

Add initial support for the color-scheme CSS property, allowing pages to
choose between light and dark system colors per-element, and such.

Things that are left to do so that this can be enabled by default:

 * Dark system colors on Windows / Android / Standins.
 * Dark Canvas/CanvasText/Link visited colors (which right now are set
   via PreferenceSheet).
 * Dark form controls in nsNativeBasicTheme.
 * Processing the color-scheme meta tag to fill-in
   Document::mColorSchemeBits.

But this seems like enough progress to be landable on its own.

Differential Revision: https://phabricator.services.mozilla.com/D120843
This commit is contained in:
Emilio Cobos Álvarez 2023-05-22 11:56:02 +02:00 committed by Oriol Brufau
parent fd41056ca5
commit 028f2f95d2
6 changed files with 143 additions and 3 deletions

View file

@ -95,6 +95,17 @@ ${helpers.predefined_type(
has_effect_on_gecko_scrollbars=False,
)}
${helpers.predefined_type(
"color-scheme",
"ColorScheme",
"specified::color::ColorScheme::normal()",
engines="gecko",
spec="https://drafts.csswg.org/css-color-adjust/#color-scheme-prop",
gecko_pref="layout.css.color-scheme.enabled",
animation_value_type="discrete",
has_effect_on_gecko_scrollbars=False,
)}
${helpers.predefined_type(
"scrollbar-color",
"ui::ScrollbarColor",

View file

@ -1376,6 +1376,9 @@ impl LonghandId {
LonghandId::FontStyle |
LonghandId::FontFamily |
// color-scheme affects how system colors resolve.
LonghandId::ColorScheme |
// Needed to properly compute the writing mode, to resolve logical
// properties, and similar stuff.
LonghandId::WritingMode |