Bug: with
#enable-force-dark on and a light system theme, both white
boxes become dark. The right box has color-scheme: only light,
which should keep it white. The left box has no opt-out and should stay dark.
Both captures use the same locally built
content_shell, the same HTML, and
preferredColorScheme=1,forceDarkModeEnabled=true. Only
ForceDarkRespectsColorSchemeOnly is disabled for BEFORE.
Rendered and Expected are screenshots from
the same local content_shell with force-dark enabled. A live
iframe in an ordinary browser would show both boxes white because
force-dark is off; open the repro in a browser
launched with the flags below to check it yourself.
Captured Chromium rendering with force-dark on and
ForceDarkRespectsColorSchemeOnly disabled; both tiles dark.
Expected under force-dark on a light system: locally built content_shell with the fix.
Yellow = pixels changed between BEFORE and AFTER; the left box stays dark.
ComputedStyleBuilder::SetUsedColorScheme() no longer forces
dark for a single only scheme;
ExtractColorSchemes() ignores only when multiple
schemes are listed. The base pixel test covers a dark system theme and the
virtual test covers a light theme with force-dark enabled.
2 ForceDarkTest unit tests and 2 pixel web tests pass. The
light-theme forced-dark pixel test fails with an image diff when the kill
switch is off. The local Chrome build also shows the white opt-out tile.
To see the live behavior with the local Chrome build, run
cr https://static.januschka.com/i-450471085/repro.html
--blink-settings=preferredColorScheme=1,forceDarkModeEnabled=true.
Add --disable-blink-features=ForceDarkRespectsColorSchemeOnly
for the BEFORE behavior. The capture script uses Pillow and websocket-client;
run xvfb-run -a python3 capture_screenshots.py from this directory.