Bug 1478576 - Use nsBaseWidget::NotifyThemeChanged for dark/liehgt theme changes on Windows 10. r?mhowell
Now nsBaseWidget::NotifyThemeChanged properly notifies to the pres shell.
MozReview-Commit-ID: Kmd68ckHanl
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5320,21 +5320,18 @@ nsWindow::ProcessMessage(UINT msg, WPARA
break;
}
if (lParam) {
auto lParamString = reinterpret_cast<const wchar_t*>(lParam);
if (!wcscmp(lParamString, L"ImmersiveColorSet")) {
// This might be the Win10 dark mode setting; only way to tell
// is to actually force a theme change, since we don't get
// WM_THEMECHANGED or WM_SYSCOLORCHANGE when that happens.
- if (IsWin10OrLater() && mWindowType == eWindowType_toplevel) {
- nsIPresShell* presShell = mWidgetListener->GetPresShell();
- if (presShell) {
- presShell->ThemeChanged();
- }
+ if (IsWin10OrLater()) {
+ NotifyThemeChanged();
}
// WM_SYSCOLORCHANGE is not dispatched for accent color changes
OnSysColorChanged();
break;
}
if (IsWin10OrLater() && mWindowType == eWindowType_invisible) {
if (!wcscmp(lParamString, L"UserInteractionMode")) {
nsCOMPtr<nsIWindowsUIUtils> uiUtils(do_GetService("@mozilla.org/windows-ui-utils;1"));