Bug 1851906 - Make unspecified color-scheme default to preferred in all chrome-enabled contexts, not only chrome docs. r=sfoster,desktop-theme-reviewers

This shouldn't introduce any behavior difference in practice, since all
chrome docs already have this behavior, and all non-chrome docs loaded
from chrome schemes should as well, in practice, via the
<meta name=color-scheme meta tag>.

This makes it easy to introduce some of the changes discussed in
bug 1836440 tho, since it avoids having to add color-scheme: dark light
to all the <svg> icons.

This check is also more consistent with how we enable all other CSS
features.

Differential Revision: https://phabricator.services.mozilla.com/D187599
This commit is contained in:
Emilio Cobos Álvarez 2023-09-08 22:51:54 +00:00
parent 33dbd41ede
commit ea5d8c900e

View File

@ -1393,8 +1393,7 @@ ColorScheme LookAndFeel::ColorSchemeForStyle(
}
// No value specified. Chrome docs always supports both, so use the preferred
// color-scheme.
if (aMode == ColorSchemeMode::Preferred ||
nsContentUtils::IsChromeDoc(&aDoc)) {
if (aMode == ColorSchemeMode::Preferred || aDoc.ChromeRulesEnabled()) {
return aDoc.PreferredColorScheme();
}
// Default content to light.