Bug 1478576 - Use nsBaseWidget::NotifyThemeChanged for dark/liehgt theme changes on Windows 10. r?mhowell draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 07 Aug 2018 11:56:22 +0900
changeset 827106 5b8a35c265a09672f0d06004f23e58e498bb6ad8
parent 827105 05a1a60f699d3cda68ac5227fa359ffe7e0a6b08
child 827107 94d44a5d4fa03b536cf3796b0bee2e1c1920631c
child 827108 cb0206cdef1c2b9e5512d048e909451833f5c87e
push id118467
push userhikezoe@mozilla.com
push dateTue, 07 Aug 2018 02:56:46 +0000
reviewersmhowell
bugs1478576
milestone63.0a1
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
widget/windows/nsWindow.cpp
--- 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"));