You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Re-evaluate @media when the system colour scheme changes
The adapters already invalidated their cached theme on a system preference
change, but nothing acted on it: the cascade is only re-evaluated during layout,
and an idle window never lays out - so switching Windows between light and dark
left prefers-color-scheme rules stuck at whatever was true when the document
loaded.
RAdapter gains a ColorSchemeChanged event. HtmlContainerInt subscribes and asks
the host to lay out and repaint, which runs the existing viewport check and
re-cascades if the outcome moved. The event only reports a real change: the
WinForms and WPF adapters re-read the theme and compare, since the General
preference category covers much more than the theme and would otherwise force a
re-cascade on every unrelated setting change.
The handler is detached on dispose - the adapter is a process-wide singleton and
would otherwise keep every container that ever rendered alive.
The re-cascade itself stays in PerformLayout rather than the event handler,
because SystemEvents can raise on a thread other than the host's.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments